Skip to content
Snippets Groups Projects
Commit 00ae5a76 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

rename settings_filename to config_filename

parent ce021b41
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ example configuration parameters. These ...@@ -22,7 +22,7 @@ example configuration parameters. These
parameters should stored in a file formatted parameters should stored in a file formatted
similarly to `config.json.example`, and the name similarly to `config.json.example`, and the name
of this file should be stored in the environment of this file should be stored in the environment
variable `SETTINGS_FILENAME` when running the service. variable `CONFIG_FILENAME` when running the service.
## Running this module ## Running this module
...@@ -33,7 +33,7 @@ For example, the application could be launched as follows: ...@@ -33,7 +33,7 @@ For example, the application could be launched as follows:
```bash ```bash
$ export FLASK_APP=app.py $ export FLASK_APP=app.py
$ export SETTINGS_FILENAME=config.json $ export CONFIG_FILENAME=config.json
$ flask run $ flask run
``` ```
......
...@@ -15,19 +15,19 @@ CONFIG_KEY = 'CONFIG_PARAMS' ...@@ -15,19 +15,19 @@ CONFIG_KEY = 'CONFIG_PARAMS'
def create_app(): def create_app():
""" """
overrides default settings with those found overrides default settings with those found
in the file read from env var SETTINGS_FILENAME in the file read from env var CONFIG_FILENAME
:return: a new flask app instance :return: a new flask app instance
""" """
required_env_vars = ['SETTINGS_FILENAME'] required_env_vars = ['CONFIG_FILENAME']
assert all([n in os.environ for n in required_env_vars]), \ assert all([n in os.environ for n in required_env_vars]), \
'environment variables %r must be defined' % required_env_vars 'environment variables %r must be defined' % required_env_vars
app_config = config.defaults() app_config = config.defaults()
if 'SETTINGS_FILENAME' in os.environ: if 'CONFIG_FILENAME' in os.environ:
with open(os.environ['SETTINGS_FILENAME']) as f: with open(os.environ['CONFIG_FILENAME']) as f:
app_config.update(config.load(f)) app_config.update(config.load(f))
app = Flask(__name__) app = Flask(__name__)
......
...@@ -59,6 +59,6 @@ def data_config_filename(data_config): ...@@ -59,6 +59,6 @@ def data_config_filename(data_config):
@pytest.fixture @pytest.fixture
def client(data_config_filename): def client(data_config_filename):
os.environ['SETTINGS_FILENAME'] = data_config_filename os.environ['CONFIG_FILENAME'] = data_config_filename
with brian_dashboard_manager.create_app().test_client() as c: with brian_dashboard_manager.create_app().test_client() as c:
yield c yield c
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment