From 00ae5a76b625c28fc0382e0000191770cc260353 Mon Sep 17 00:00:00 2001 From: Bjarke Madsen <bjarke.madsen@geant.org> Date: Wed, 24 Feb 2021 12:47:42 +0100 Subject: [PATCH] rename settings_filename to config_filename --- README.md | 4 ++-- brian_dashboard_manager/__init__.py | 8 ++++---- test/conftest.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a548a94..8cae3b9 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ example configuration parameters. These parameters should stored in a file formatted similarly to `config.json.example`, and the name 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 @@ -33,7 +33,7 @@ For example, the application could be launched as follows: ```bash $ export FLASK_APP=app.py -$ export SETTINGS_FILENAME=config.json +$ export CONFIG_FILENAME=config.json $ flask run ``` diff --git a/brian_dashboard_manager/__init__.py b/brian_dashboard_manager/__init__.py index 1f4637c..e929766 100644 --- a/brian_dashboard_manager/__init__.py +++ b/brian_dashboard_manager/__init__.py @@ -15,19 +15,19 @@ CONFIG_KEY = 'CONFIG_PARAMS' def create_app(): """ 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 """ - required_env_vars = ['SETTINGS_FILENAME'] + required_env_vars = ['CONFIG_FILENAME'] assert all([n in os.environ for n in required_env_vars]), \ 'environment variables %r must be defined' % required_env_vars app_config = config.defaults() - if 'SETTINGS_FILENAME' in os.environ: - with open(os.environ['SETTINGS_FILENAME']) as f: + if 'CONFIG_FILENAME' in os.environ: + with open(os.environ['CONFIG_FILENAME']) as f: app_config.update(config.load(f)) app = Flask(__name__) diff --git a/test/conftest.py b/test/conftest.py index 09de236..148685d 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -59,6 +59,6 @@ def data_config_filename(data_config): @pytest.fixture 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: yield c -- GitLab