-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
89 lines (69 loc) · 2.31 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/python
"""Configuration loader for different environments."""
import credstash
class Config(object):
"""Defaults for the configuration objects."""
DEBUG = True
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = credstash.getSecret(
name="observatory.secret_key",
context={'app': 'serverless-observatory'},
region="us-east-1"
)
SERVER_NAME = "serverless-observatory.threatresponse.cloud"
SESSION_COOKIE_HTTPONLY = True
LOGGER_NAME = "serverless-observatory"
TEMPLATES_AUTO_RELOAD = True
class ProductionConfig(Config):
SERVER_NAME = "serverless-observatory.threatresponse.cloud"
PREFERRED_URL_SCHEME = 'https'
DEBUG = True
class StagingConfig(Config):
DEVELOPMENT = True
DEBUG = True
class DevelopmentConfig(Config):
DEVELOPMENT = True
DEBUG = True
SERVER_NAME = "localhost:5000"
class TestingConfig(Config):
TESTING = True
class OIDCConfig(object):
"""Convienience Object for returning required vars to flask."""
def __init__(self):
"""General object initializer."""
self.OIDC_DOMAIN = credstash.getSecret(
name="observatory.oidc_domain",
context={'app': 'serverless-observatory'},
region="us-east-1"
)
self.OIDC_CLIENT_ID = credstash.getSecret(
name="observatory.client_id",
context={'app': 'serverless-observatory'},
region="us-east-1"
)
self.OIDC_CLIENT_SECRET = credstash.getSecret(
name="observatory.client_secret",
context={'app': 'serverless-observatory'},
region="us-east-1"
)
self.LOGIN_URL = "https://{DOMAIN}/login?client={CLIENT_ID}".format(
DOMAIN=self.OIDC_DOMAIN,
CLIENT_ID=self.OIDC_CLIENT_ID
)
def auth_endpoint(self):
return "https://{DOMAIN}/authorize".format(
DOMAIN=self.OIDC_DOMAIN
)
def token_endpoint(self):
return "https://{DOMAIN}/oauth/token".format(
DOMAIN=self.OIDC_DOMAIN
)
def userinfo_endpoint(self):
return "https://{DOMAIN}/userinfo".format(
DOMAIN=self.OIDC_DOMAIN
)
def client_id(self):
return self.OIDC_CLIENT_ID
def client_secret(self):
return self.OIDC_CLIENT_SECRET