Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 185672a

Browse files
committedOct 1, 2024·
nvflare project configuration
1 parent 4dbce6a commit 185672a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 

‎docker/dashboard/app/wsgi.py

+41
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
import os
2+
13
from nvflare.dashboard.application import init_app
24

35
app = init_app()
6+
7+
with app.app_context():
8+
9+
from nvflare.dashboard.application.store import Store
10+
11+
if Store.ready():
12+
13+
resp = Store.get_project()
14+
if resp['status'].lower() != 'ok':
15+
print("Error: Could not get project from the Store")
16+
exit(1)
17+
project = resp['project']
18+
19+
env_vars = {
20+
'server1': 'NVFL_PROJECT_SERVER1',
21+
'server2': 'NVFL_PROJECT_SERVER2',
22+
'short_name': 'NVFL_PROJECT_SHORT_NAME',
23+
'title': 'NVFL_PROJECT_TITLE',
24+
'description': 'NVFL_PROJECT_DESCRIPTION',
25+
'app_location': 'NVFL_PROJECT_APP_LOCATION',
26+
'starting_date': 'NVFL_PROJECT_STARTING_DATE',
27+
'end_date': 'NVFL_PROJECT_END_DATE',
28+
'public': 'NVFL_PROJECT_PUBLIC',
29+
'frozen': 'NVFL_PROJECT_FROZEN'
30+
}
31+
32+
project_conf = {}
33+
for var, env_var in env_vars.items():
34+
if env_var in os.environ.keys() and len(os.environ[env_var]) > 0:
35+
project_conf[var] = os.environ[env_var]
36+
37+
if len(project_conf) > 0:
38+
project.update(project_conf)
39+
resp = Store.set_project(project)
40+
if resp['status'].lower() != 'ok':
41+
print('Error: Could not update project configuration')
42+
exit(1)
43+
else:
44+
print('Project configuration updated')

0 commit comments

Comments
 (0)
Please sign in to comment.