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
This commit is contained in:
@@ -33,7 +33,6 @@ from stackalytics.openstack.common import log as logging
|
|||||||
from stackalytics.processor import config
|
from stackalytics.processor import config
|
||||||
from stackalytics.processor import utils
|
from stackalytics.processor import utils
|
||||||
|
|
||||||
|
|
||||||
# Application objects ---------
|
# Application objects ---------
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
@@ -47,14 +46,6 @@ LOG = logging.getLogger(__name__)
|
|||||||
conf = cfg.CONF
|
conf = cfg.CONF
|
||||||
conf.register_opts(config.OPTS)
|
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 ---------
|
# Handlers ---------
|
||||||
|
|
||||||
@@ -602,6 +593,16 @@ def remove_ctrl_chars(text):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
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)
|
app.run(cfg.CONF.listen_host, cfg.CONF.listen_port)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@@ -263,7 +263,7 @@ def main():
|
|||||||
conf = cfg.CONF
|
conf = cfg.CONF
|
||||||
conf.register_cli_opts(config.OPTS)
|
conf.register_cli_opts(config.OPTS)
|
||||||
conf.register_opts(config.OPTS)
|
conf.register_opts(config.OPTS)
|
||||||
conf()
|
conf(project='stackalytics')
|
||||||
|
|
||||||
logging.setup('stackalytics')
|
logging.setup('stackalytics')
|
||||||
LOG.info('Logging enabled')
|
LOG.info('Logging enabled')
|
||||||
|
Reference in New Issue
Block a user