1
1
from sheepdog .api import app , app_init
2
2
from os import environ
3
- import confighelper
3
+ import os
4
+ import bin .confighelper as confighelper
4
5
5
6
APP_NAME = "sheepdog"
6
7
@@ -12,49 +13,58 @@ def load_json(file_name):
12
13
conf_data = load_json ("creds.json" )
13
14
config = app .config
14
15
15
- config ["AUTH" ] = "https://auth.service.consul:5000/v3/"
16
- config ["AUTH_ADMIN_CREDS" ] = None
17
- config ["INTERNAL_AUTH" ] = None
18
-
19
16
# ARBORIST deprecated, replaced by ARBORIST_URL
20
17
# ARBORIST_URL is initialized in app_init() directly
21
18
config ["ARBORIST" ] = "http://arborist-service/"
22
19
23
- # Signpost: deprecated, replaced by index client.
24
- config ["SIGNPOST" ] = {
25
- "host" : environ .get ("SIGNPOST_HOST" ) or "http://indexd-service" ,
26
- "version" : "v0" ,
27
- "auth" : ("gdcapi" , conf_data .get ("indexd_password" , "{{indexd_password}}" )),
28
- }
29
20
config ["INDEX_CLIENT" ] = {
30
- "host" : environ .get ("INDEX_CLIENT_HOST" ) or "http://indexd-service" ,
21
+ "host" : os . environ .get ("INDEX_CLIENT_HOST" ) or "http://indexd-service" ,
31
22
"version" : "v0" ,
32
- "auth" : ("gdcapi" , conf_data .get ("indexd_password" , "{{indexd_password}}" )),
23
+ # The user should be "sheepdog", but for legacy reasons, we use "gdcapi" instead
24
+ "auth" : (
25
+ (
26
+ environ .get ("INDEXD_USER" , "gdcapi" ),
27
+ environ .get ("INDEXD_PASS" )
28
+ or conf_data .get ("indexd_password" , "{{indexd_password}}" ),
29
+ )
30
+ ),
33
31
}
34
- config [ "FAKE_AUTH" ] = False
32
+
35
33
config ["PSQLGRAPH" ] = {
36
- "host" : conf_data [ "db_host" ] ,
37
- "user" : conf_data [ "db_username" ] ,
38
- "password" : conf_data [ "db_password" ] ,
39
- "database" : conf_data [ "db_database" ] ,
34
+ "host" : conf_data . get ( "db_host" , os . environ . get ( "PGHOST" , "localhost" )) ,
35
+ "user" : conf_data . get ( "db_username" , os . environ . get ( "PGUSER" , "sheepdog" )) ,
36
+ "password" : conf_data . get ( "db_password" , os . environ . get ( "PGPASSWORD" , "sheepdog" )) ,
37
+ "database" : conf_data . get ( "db_database" , os . environ . get ( "PGDB" , "sheepdog" )) ,
40
38
}
41
39
42
40
config ["FLASK_SECRET_KEY" ] = conf_data .get ("gdcapi_secret_key" , "{{gdcapi_secret_key}}" )
43
- config ["PSQL_USER_DB_CONNECTION" ] = "postgresql://%s:%s@%s:5432/%s" % tuple (
44
- [
45
- conf_data .get (key , key )
46
- for key in ["fence_username" , "fence_password" , "fence_host" , "fence_database" ]
47
- ]
41
+ fence_username = conf_data .get (
42
+ "fence_username" , os .environ .get ("FENCE_DB_USER" , "fence" )
43
+ )
44
+ fence_password = conf_data .get (
45
+ "fence_password" , os .environ .get ("FENCE_DB_PASS" , "fence" )
46
+ )
47
+ fence_host = conf_data .get ("fence_host" , os .environ .get ("FENCE_DB_HOST" , "localhost" ))
48
+ fence_database = conf_data .get (
49
+ "fence_database" , os .environ .get ("FENCE_DB_DATABASE" , "fence" )
50
+ )
51
+ config ["PSQL_USER_DB_CONNECTION" ] = "postgresql://%s:%s@%s:5432/%s" % (
52
+ fence_username ,
53
+ fence_password ,
54
+ fence_host ,
55
+ fence_database ,
48
56
)
49
57
50
- config ["USER_API" ] = "https://%s/user" % conf_data ["hostname" ] # for use by authutils
58
+ config ["USER_API" ] = "https://%s/user" % conf_data .get (
59
+ "hostname" , os .environ .get ("CONF_HOSTNAME" , "localhost" )
60
+ ) # for use by authutils
51
61
# use the USER_API URL instead of the public issuer URL to accquire JWT keys
52
62
config ["FORCE_ISSUER" ] = True
53
- config ["DICTIONARY_URL" ] = environ .get (
63
+ config ["DICTIONARY_URL" ] = os . environ .get (
54
64
"DICTIONARY_URL" ,
55
65
"https://s3.amazonaws.com/dictionary-artifacts/datadictionary/develop/schema.json" ,
56
66
)
57
67
58
68
app_init (app )
59
69
application = app
60
- application .debug = environ .get ("GEN3_DEBUG" ) == "True"
70
+ application .debug = os . environ .get ("GEN3_DEBUG" ) == "True"
0 commit comments