1
+ import os
2
+
1
3
from nvflare .dashboard .application import init_app
2
4
3
5
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