Ensuring that the passed in configuration has precedence over the environment config. (#507)
This commit is contained in:
parent
d0ccd85afe
commit
5345170a4f
|
@ -90,12 +90,15 @@ def configure_app(app, config=None):
|
||||||
:param config:
|
:param config:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
# respect the config first
|
||||||
|
if config and config != 'None':
|
||||||
|
app.config.from_object(from_file(config))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
app.config.from_envvar("LEMUR_CONF")
|
app.config.from_envvar("LEMUR_CONF")
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
if config and config != 'None':
|
# look in default paths
|
||||||
app.config.from_object(from_file(config))
|
if os.path.isfile(os.path.expanduser("~/.lemur/lemur.conf.py")):
|
||||||
elif os.path.isfile(os.path.expanduser("~/.lemur/lemur.conf.py")):
|
|
||||||
app.config.from_object(from_file(os.path.expanduser("~/.lemur/lemur.conf.py")))
|
app.config.from_object(from_file(os.path.expanduser("~/.lemur/lemur.conf.py")))
|
||||||
else:
|
else:
|
||||||
app.config.from_object(from_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default.conf.py')))
|
app.config.from_object(from_file(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'default.conf.py')))
|
||||||
|
|
Loading…
Reference in New Issue