Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
brian-dashboard-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
brian
brian-dashboard-manager
Commits
00ae5a76
Commit
00ae5a76
authored
4 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
rename settings_filename to config_filename
parent
ce021b41
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
brian_dashboard_manager/__init__.py
+4
-4
4 additions, 4 deletions
brian_dashboard_manager/__init__.py
test/conftest.py
+1
-1
1 addition, 1 deletion
test/conftest.py
with
7 additions
and
7 deletions
README.md
+
2
−
2
View file @
00ae5a76
...
...
@@ -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
```
...
...
This diff is collapsed.
Click to expand it.
brian_dashboard_manager/__init__.py
+
4
−
4
View file @
00ae5a76
...
...
@@ -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__
)
...
...
This diff is collapsed.
Click to expand it.
test/conftest.py
+
1
−
1
View file @
00ae5a76
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment