From 5345170a4fbbbbfb36f2d4b469737fb0d73ab6cb Mon Sep 17 00:00:00 2001 From: kevgliss Date: Thu, 17 Nov 2016 09:31:37 -0800 Subject: [PATCH] Ensuring that the passed in configuration has precedence over the environment config. (#507) --- lemur/factory.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lemur/factory.py b/lemur/factory.py index 13b9c8ba..28f48a98 100644 --- a/lemur/factory.py +++ b/lemur/factory.py @@ -90,12 +90,15 @@ def configure_app(app, config=None): :param config: :return: """ + # respect the config first + if config and config != 'None': + app.config.from_object(from_file(config)) + try: app.config.from_envvar("LEMUR_CONF") except RuntimeError: - if config and config != 'None': - app.config.from_object(from_file(config)) - elif os.path.isfile(os.path.expanduser("~/.lemur/lemur.conf.py")): + # look in default paths + if os.path.isfile(os.path.expanduser("~/.lemur/lemur.conf.py")): app.config.from_object(from_file(os.path.expanduser("~/.lemur/lemur.conf.py"))) else: app.config.from_object(from_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default.conf.py')))