From c5931377f10d9a70385ed666bd5782a837c08d76 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 8 Jun 2014 11:38:57 -0700 Subject: [PATCH] Update to use sensible defaults for oslo.config CONF should be passed the name of the application, which means that /etc/stackalytics/stackalytics.conf will be what is looked for in the absence of other options. This is great, since it's easy to put a file in the place that defaults expect. Change-Id: I11ff134da24931affadc58ad0989185ae6df7e92 --- dashboard/web.py | 19 ++++++++++--------- stackalytics/processor/main.py | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dashboard/web.py b/dashboard/web.py index 208d5b96a..87400294f 100644 --- a/dashboard/web.py +++ b/dashboard/web.py @@ -33,7 +33,6 @@ from stackalytics.openstack.common import log as logging from stackalytics.processor import config from stackalytics.processor import utils - # Application objects --------- app = flask.Flask(__name__) @@ -47,14 +46,6 @@ LOG = logging.getLogger(__name__) conf = cfg.CONF conf.register_opts(config.OPTS) -conf_file = os.getenv('STACKALYTICS_CONF') -if conf_file and os.path.isfile(conf_file): - conf(default_config_files=[conf_file]) - app.config['DEBUG'] = cfg.CONF.debug - -logging.setup('dashboard') -LOG.info('Stackalytics.dashboard is configured via "%s"', conf_file) - # Handlers --------- @@ -602,6 +593,16 @@ def remove_ctrl_chars(text): def main(): + conf_file = os.getenv('STACKALYTICS_CONF') + if conf_file and os.path.isfile(conf_file): + conf(default_config_files=[conf_file]) + app.config['DEBUG'] = cfg.CONF.debug + LOG.info('Stackalytics.dashboard is configured via "%s"', conf_file) + else: + conf(project='stackalytics') + + logging.setup('dashboard') + app.run(cfg.CONF.listen_host, cfg.CONF.listen_port) if __name__ == '__main__': diff --git a/stackalytics/processor/main.py b/stackalytics/processor/main.py index ecc491c46..a980fbf71 100644 --- a/stackalytics/processor/main.py +++ b/stackalytics/processor/main.py @@ -263,7 +263,7 @@ def main(): conf = cfg.CONF conf.register_cli_opts(config.OPTS) conf.register_opts(config.OPTS) - conf() + conf(project='stackalytics') logging.setup('stackalytics') LOG.info('Logging enabled')