-
Notifications
You must be signed in to change notification settings - Fork 20
/
config.py
137 lines (107 loc) · 3.63 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import os
from dmutils.status import get_version_label
class Config:
VERSION = get_version_label(
os.path.abspath(os.path.dirname(__file__))
)
DM_SEARCH_API_URL = None
DM_SEARCH_API_AUTH_TOKEN = None
DM_API_AUTH_TOKENS = None
DM_API_CALLBACK_AUTH_TOKENS = None
ES_ENABLED = True
AUTH_REQUIRED = True
DM_HTTP_PROTO = 'http'
# Logging
DM_LOG_LEVEL = 'DEBUG'
DM_PLAIN_TEXT_LOGS = False
DM_LOG_PATH = None
DM_APP_NAME = 'api'
DM_API_SERVICES_PAGE_SIZE = 100
DM_API_SUPPLIERS_PAGE_SIZE = 100
DM_API_BRIEFS_PAGE_SIZE = 100
DM_API_BRIEF_RESPONSES_PAGE_SIZE = 100
DM_API_BUYER_DOMAINS_PAGE_SIZE = 100
DM_API_PROJECTS_PAGE_SIZE = 100
DM_API_OUTCOMES_PAGE_SIZE = 100
DM_ALLOWED_ADMIN_DOMAINS = ['digital.cabinet-office.gov.uk', 'crowncommercial.gov.uk', 'user.marketplace.team',
'notifications.service.gov.uk']
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/digitalmarketplace'
SQLALCHEMY_RECORD_QUERIES = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
# If you are changing failed login limit, remember to update NO_ACCOUNT_MESSAGE in user-frontend
DM_FAILED_LOGIN_LIMIT = 5
VCAP_SERVICES = None
DM_FRAMEWORK_TO_ES_INDEX = {
'g-cloud-9': {
'services': 'g-cloud-9'
},
'g-cloud-10': {
'services': 'g-cloud-10'
},
'g-cloud-11': {
'services': 'g-cloud-11'
},
'g-cloud-12': {
'services': 'g-cloud-12'
},
'digital-outcomes-and-specialists': {
'briefs': 'briefs-digital-outcomes-and-specialists'
},
'digital-outcomes-and-specialists-2': {
'briefs': 'briefs-digital-outcomes-and-specialists'
},
'digital-outcomes-and-specialists-3': {
'briefs': 'briefs-digital-outcomes-and-specialists'
},
'digital-outcomes-and-specialists-4': {
'briefs': 'briefs-digital-outcomes-and-specialists'
},
'digital-outcomes-and-specialists-5': {
'briefs': 'briefs-digital-outcomes-and-specialists'
},
}
class Test(Config):
SERVER_NAME = '127.0.0.1:5000'
DM_SEARCH_API_AUTH_TOKEN = 'test'
DM_SEARCH_API_URL = 'http://localhost'
DEBUG = True
DM_PLAIN_TEXT_LOGS = True
ES_ENABLED = False
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/digitalmarketplace_test'
DM_API_AUTH_TOKENS = 'myToken'
DM_API_CALLBACK_AUTH_TOKENS = 'myCallbackToken'
DM_API_SERVICES_PAGE_SIZE = 5
DM_API_SUPPLIERS_PAGE_SIZE = 5
DM_API_BRIEFS_PAGE_SIZE = 5
DM_API_BRIEF_RESPONSES_PAGE_SIZE = 5
DM_API_PROJECTS_PAGE_SIZE = 5
class Development(Config):
DEBUG = True
DM_PLAIN_TEXT_LOGS = True
DM_API_AUTH_TOKENS = 'myToken'
DM_API_CALLBACK_AUTH_TOKENS = 'myToken'
DM_SEARCH_API_AUTH_TOKEN = 'myToken'
DM_SEARCH_API_URL = f"http://localhost:{os.getenv('DM_SEARCH_API_PORT', 5009)}"
class SharedLive(Config):
"""Base config for deployed environments shared between GPaaS and AWS"""
DEBUG = False
DM_HTTP_PROTO = 'https'
class NativeAWS(SharedLive):
DM_APP_NAME = 'data-api'
class Live(SharedLive):
"""Base config for deployed environments"""
DM_LOG_PATH = '/var/log/digitalmarketplace/application.log'
class Preview(Live):
pass
class Staging(Live):
pass
class Production(Live):
DM_ALLOWED_ADMIN_DOMAINS = ['digital.cabinet-office.gov.uk', 'crowncommercial.gov.uk']
configs = {
'development': Development,
'native-aws': NativeAWS,
'test': Test,
'preview': Preview,
'staging': Staging,
'production': Production,
}