| |
@@ -26,15 +26,18 @@
|
| |
if os.getenv('DEV') == 'true':
|
| |
default_config_obj = 'waiverdb.config.DevelopmentConfig'
|
| |
default_config_file = os.getcwd() + '/conf/settings.py'
|
| |
+ silent = True
|
| |
elif os.getenv('TEST') == 'true':
|
| |
default_config_obj = 'waiverdb.config.TestingConfig'
|
| |
default_config_file = os.getcwd() + '/conf/settings.py'
|
| |
+ silent = True
|
| |
else:
|
| |
default_config_obj = 'waiverdb.config.ProductionConfig'
|
| |
default_config_file = '/etc/waiverdb/settings.py'
|
| |
+ silent = False
|
| |
app.config.from_object(default_config_obj)
|
| |
config_file = os.environ.get('WAIVERDB_CONFIG', default_config_file)
|
| |
- app.config.from_pyfile(config_file)
|
| |
+ app.config.from_pyfile(config_file, silent=silent)
|
| |
if os.environ.get('SECRET_KEY'):
|
| |
app.config['SECRET_KEY'] = os.environ['SECRET_KEY']
|
| |
|
| |
In conftest.py, when the application to be used for testing
was created, create_app() was called with the config_object
waiverdb.config.TestConfig.
The above allowed no custumization of the test configration
by using a configuration file.
At the same time, load_config was providing a way to tell, that
the current environment is a test environment.
In order to be able to use other databases than a local one when
running the unit tests, this change sets the 'TEST' env var
to 'true' and calls create_app() without a parameter, so that
configuration files are considered.
Setting the silent argument to True when calling from_pyfile()
allows ignoring missing cofig files when the environment is DEV or
TEST.
Signed-off-by: Hunor Csomortáni csomh@redhat.com