Allow Lemur "start" to use the global config. (#596)
* allowing our runserver to use the config specified by -c * Maintaining config for gunicorn
This commit is contained in:
parent
71ddbb409c
commit
02991c70a9
|
@ -60,11 +60,14 @@ class InstanceManager(object):
|
|||
results.append(cls())
|
||||
else:
|
||||
results.append(cls)
|
||||
|
||||
except InvalidConfiguration as e:
|
||||
current_app.logger.warning("Plugin '{0}' may not work correctly. {1}".format(class_name, e))
|
||||
|
||||
except Exception as e:
|
||||
current_app.logger.exception("Unable to import {0}. Reason: {1}".format(cls_path, e))
|
||||
continue
|
||||
|
||||
self.cache = results
|
||||
|
||||
return results
|
||||
|
|
|
@ -92,6 +92,7 @@ def configure_app(app, config=None):
|
|||
"""
|
||||
# respect the config first
|
||||
if config and config != 'None':
|
||||
app.config['CONFIG_PATH'] = config
|
||||
app.config.from_object(from_file(config))
|
||||
else:
|
||||
try:
|
||||
|
@ -103,6 +104,9 @@ def configure_app(app, config=None):
|
|||
else:
|
||||
app.config.from_object(from_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default.conf.py')))
|
||||
|
||||
# we don't use this
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
|
||||
def configure_extensions(app):
|
||||
"""
|
||||
|
|
|
@ -119,7 +119,6 @@ LOG_FILE = "lemur.log"
|
|||
# modify this if you are not using a local database
|
||||
SQLALCHEMY_DATABASE_URI = 'postgresql://lemur:lemur@localhost:5432/lemur'
|
||||
|
||||
|
||||
# AWS
|
||||
|
||||
#LEMUR_INSTANCE_PROFILE = 'Lemur'
|
||||
|
@ -372,11 +371,10 @@ class LemurServer(Command):
|
|||
|
||||
app = WSGIApplication()
|
||||
|
||||
# run startup tasks on an app like object
|
||||
pre_app = create_app(kwargs.get('config'))
|
||||
validate_conf(pre_app, REQUIRED_VARIABLES)
|
||||
# run startup tasks on a app like object
|
||||
validate_conf(current_app, REQUIRED_VARIABLES)
|
||||
|
||||
app.app_uri = 'lemur:create_app(config="{0}")'.format(kwargs.get('config'))
|
||||
app.app_uri = 'lemur:create_app(config="{0}")'.format(current_app.config.get('CONFIG_PATH'))
|
||||
|
||||
return app.run()
|
||||
|
||||
|
|
Loading…
Reference in New Issue