1
1
from peregrine .api import app , app_init
2
2
from os import environ
3
- import confighelper
3
+ import bin . confighelper as confighelper
4
4
5
5
APP_NAME = "peregrine"
6
6
@@ -12,74 +12,60 @@ def load_json(file_name):
12
12
conf_data = load_json ("creds.json" )
13
13
config = app .config
14
14
15
- config ["AUTH" ] = "https://auth.service.consul:5000/v3/"
16
- config ["AUTH_ADMIN_CREDS" ] = None
17
- config ["INTERNAL_AUTH" ] = None
18
15
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
- }
20
+
29
21
config ["INDEX_CLIENT" ] = {
30
22
"host" : environ .get ("INDEX_CLIENT_HOST" ) or "http://indexd-service" ,
31
23
"version" : "v0" ,
32
- "auth" : ("gdcapi" , conf_data .get ("indexd_password" , "{{indexd_password}}" )),
24
+ # The user should be "sheepdog", but for legacy reasons, we use "gdcapi" instead
25
+ "auth" : (
26
+ (
27
+ environ .get ("INDEXD_USER" , "gdcapi" ),
28
+ environ .get ("INDEXD_PASS" )
29
+ or conf_data .get ("indexd_password" , "{{indexd_password}}" ),
30
+ )
31
+ ),
33
32
}
34
- config [ "FAKE_AUTH" ] = False
33
+
35
34
config ["PSQLGRAPH" ] = {
36
- "host" : conf_data .get ("db_host" , "{{db_host}}" ),
37
- "user" : conf_data .get ("db_username" , "{{db_username}}" ),
38
- "password" : conf_data .get ("db_password" , "{{db_password}}" ),
39
- "database" : conf_data .get ("db_database" , "{{db_database}}" ),
35
+ "host" : environ .get ("PGHOST" ) or conf_data .get ("db_host" , "{{db_host}}" ),
36
+ "user" : environ .get ("PGUSER" ) or conf_data .get ("db_username" , "{{db_username}}" ),
37
+ "password" : environ .get ("PGPASSWORD" )
38
+ or conf_data .get ("db_password" , "{{db_password}}" ),
39
+ "database" : environ .get ("PGDB" ) or conf_data .get ("db_database" , "{{db_database}}" ),
40
40
}
41
41
42
- config ["HMAC_ENCRYPTION_KEY" ] = conf_data .get ("hmac_key" , "{{hmac_key}}" )
43
- config ["FLASK_SECRET_KEY" ] = conf_data .get ("gdcapi_secret_key" , "{{gdcapi_secret_key}}" )
44
- config ["PSQL_USER_DB_CONNECTION" ] = "postgresql://%s:%s@%s:5432/%s" % tuple (
45
- [
46
- conf_data .get (key , key )
47
- for key in ["fence_username" , "fence_password" , "fence_host" , "fence_database" ]
48
- ]
42
+ fence_username = environ .get ("FENCE_DB_USER" ) or conf_data .get (
43
+ "fence_username" , "{{fence_username}}"
44
+ )
45
+ fence_password = environ .get ("FENCE_DB_PASS" ) or conf_data .get (
46
+ "fence_password" , "{{fence_password}}"
47
+ )
48
+ fence_host = environ .get ("FENCE_DB_HOST" ) or conf_data .get (
49
+ "fence_host" , "{{fence_host}}"
50
+ )
51
+ fence_database = environ .get ("FENCE_DB_DBNAME" ) or conf_data .get (
52
+ "fence_database" , "{{fence_database}}"
49
53
)
54
+ config ["PSQL_USER_DB_CONNECTION" ] = "postgresql://%s:%s@%s:5432/%s" % (
55
+ fence_username ,
56
+ fence_password ,
57
+ fence_host ,
58
+ fence_database ,
59
+ )
60
+
50
61
51
62
config ["DICTIONARY_URL" ] = environ .get (
52
63
"DICTIONARY_URL" ,
53
64
"https://s3.amazonaws.com/dictionary-artifacts/datadictionary/develop/schema.json" ,
54
65
)
55
66
56
- config ["SUBMISSION" ] = {"bucket" : conf_data .get ("bagit_bucket" , "{{bagit_bucket}}" )}
57
-
58
- config ["STORAGE" ] = {
59
- "s3" : {
60
- "access_key" : conf_data .get ("s3_access" , "{{s3_access}}" ),
61
- "secret_key" : conf_data .get ("s3_secret" , "{{s3_secret}}" ),
62
- }
63
- }
64
-
65
- config ["OIDC_ISSUER" ] = "https://%s/user" % conf_data ["hostname" ]
66
-
67
- config ["OAUTH2" ] = {
68
- "client_id" : conf_data .get ("oauth2_client_id" , "{{oauth2_client_id}}" ),
69
- "client_secret" : conf_data .get ("oauth2_client_secret" , "{{oauth2_client_secret}}" ),
70
- "api_base_url" : "https://%s/user/" % conf_data ["hostname" ],
71
- "authorize_url" : "https://%s/user/oauth2/authorize" % conf_data ["hostname" ],
72
- "access_token_url" : "https://%s/user/oauth2/token" % conf_data ["hostname" ],
73
- "refresh_token_url" : "https://%s/user/oauth2/token" % conf_data ["hostname" ],
74
- "client_kwargs" : {
75
- "redirect_uri" : "https://%s/api/v0/oauth2/authorize" % conf_data ["hostname" ],
76
- "scope" : "openid data user" ,
77
- },
78
- # deprecated key values, should be removed after all commons use new oidc
79
- "internal_oauth_provider" : "http://fence-service/oauth2/" ,
80
- "oauth_provider" : "https://%s/user/oauth2/" % conf_data ["hostname" ],
81
- "redirect_uri" : "https://%s/api/v0/oauth2/authorize" % conf_data ["hostname" ],
82
- }
67
+ hostname = environ .get ("CONF_HOSTNAME" ) or conf_data ["hostname" ]
68
+ config ["OIDC_ISSUER" ] = "https://%s/user" % hostname
83
69
84
70
config ["USER_API" ] = config ["OIDC_ISSUER" ] # for use by authutils
85
71
# use the USER_API URL instead of the public issuer URL to accquire JWT keys
0 commit comments