-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
consul_config.py.ctmpl
133 lines (109 loc) · 4.5 KB
/
consul_config.py.ctmpl
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
{{- define "KEY" -}}
{{- key (printf "docker-server-configs/MeB/config.%s.json/%s" (env "DEPLOY_ENV") .) -}}
{{- end -}}
{{- define "KEY_OR_NONE" -}}
{{- keyOrDefault (printf "docker-server-configs/MeB/config.%s.json/%s" (env "DEPLOY_ENV") .) "None" -}}
{{- end -}}
{{- define "KEY_ARRAY" -}}
{{- range $index, $element := (key (printf "docker-server-configs/MeB/config.%s.json/%s" (env "DEPLOY_ENV") .) | parseJSON) -}}
"{{.}}",
{{- end -}}
{{- end -}}
SECRET_KEY = '''{{template "KEY" "secret_key"}}'''
DEBUG = False
{{if service "pgbouncer-master"}}
{{with index (service "pgbouncer-master") 0}}
SQLALCHEMY_DATABASE_URI = "postgresql://{{template "KEY" "postgresql/username"}}:{{template "KEY" "postgresql/password"}}@{{.Address}}:{{.Port}}/{{template "KEY" "postgresql/db_name"}}"
SQLALCHEMY_MUSICBRAINZ_URI = 'postgresql://musicbrainz_ro@{{.Address}}:{{.Port}}/musicbrainz_db'
{{end}}
{{end}}
{{if service "metabrainz-redis"}}
{{with index (service "metabrainz-redis") 0}}
REDIS = {
"host": '''{{.Address}}''',
"port": {{.Port}},
"namespace": '''{{template "KEY" "redis/namespace"}}''',
}
{{end}}
{{end}}
# PAYMENTS
PAYMENT_PRODUCTION = {{template "KEY_OR_NONE" "payments/production"}} # Must be `True` or `False`
PAYPAL_ACCOUNT_IDS = {
"USD": '''{{template "KEY" "payments/paypal/account_ids/usd"}}''',
"EUR": '''{{template "KEY" "payments/paypal/account_ids/eur"}}''',
}
PAYPAL_BUSINESS = '''{{template "KEY" "payments/paypal/business_email"}}'''
STRIPE_KEYS = {
"USD": {
"SECRET": '''{{template "KEY" "payments/stripe/secret"}}''',
"PUBLISHABLE": '''{{template "KEY" "payments/stripe/publishable"}}''',
"WEBHOOK_SECRET": '''{{template "KEY" "payments/stripe/webhook_secret"}}''',
},
"EUR": {
"SECRET": '''{{template "KEY" "payments/stripe-eu/secret"}}''',
"PUBLISHABLE": '''{{template "KEY" "payments/stripe-eu/publishable"}}''',
"WEBHOOK_SECRET": '''{{template "KEY" "payments/stripe-eu/webhook_secret"}}''',
},
}
# MusicBrainz Base URL must have a trailing slash.
MUSICBRAINZ_BASE_URL = '''{{template "KEY" "musicbrainz/base_url"}}'''
MUSICBRAINZ_CLIENT_ID = '''{{template "KEY" "musicbrainz/client_id"}}'''
MUSICBRAINZ_CLIENT_SECRET = '''{{template "KEY" "musicbrainz/client_secret"}}'''
# QUICKBOOKS OAUTH
QUICKBOOKS_SANDBOX = '''{{template "KEY" "quickbooks/sandbox"}}'''
QUICKBOOKS_CALLBACK_URL = '''{{template "KEY" "quickbooks/callback_url"}}'''
QUICKBOOKS_CLIENT_ID = '''{{template "KEY" "quickbooks/client_id"}}'''
QUICKBOOKS_CLIENT_SECRET = '''{{template "KEY" "quickbooks/client_secret"}}'''
import os
LOG_SENTRY = {
'dsn': '''{{template "KEY" "sentry/dsn"}}''',
'environment': '''{{template "KEY" "sentry/environment"}}''',
'release': os.getenv('GIT_SHA', None),
}
# reCAPTCHA (https://www.google.com/recaptcha/)
RECAPTCHA_PUBLIC_KEY = '''{{template "KEY" "recaptcha/public_key"}}'''
RECAPTCHA_PRIVATE_KEY = '''{{template "KEY" "recaptcha/private_key"}}'''
{{if service "metabrainz-org.exim-relay"}}
{{with index (service "metabrainz-org.exim-relay") 0}}
SMTP_SERVER = '''{{.Address}}'''
SMTP_PORT = {{.Port}}
{{end}}
{{end}}
MAIL_FROM_DOMAIN = '''{{template "KEY" "mail_from_domain"}}'''
# See http://flask.pocoo.org/docs/0.10/config/#builtin-configuration-values
PREFERRED_URL_SCHEME = '''{{template "KEY" "preferred_url_scheme"}}'''
SERVER_BASE_URL = f"{PREFERRED_URL_SCHEME}://{MAIL_FROM_DOMAIN}"
{{if service "pgbouncer-slave"}}
{{with index (service "pgbouncer-slave") 0}}
MB_DATABASE_URI = "postgresql://musicbrainz_ro@{{.Address}}:{{.Port}}/musicbrainz_db"
{{end}}
{{else}}
MB_DATABASE_URI = ""
{{end}}
SQLALCHEMY_BINDS = {
"musicbrainz": MB_DATABASE_URI
}
MUSICBRAINZ_SERVER = '''{{template "KEY" "musicbrainz/oauth_server_url"}}'''
# List of email addresses
NOTIFICATION_RECIPIENTS = [
{{template "KEY_ARRAY" "notification_recipients"}}
]
# List of MusicBrainz usernames of people that are allowed to access
# admin section of the website. Usernames are case-sensetive!
ADMINS = [
{{template "KEY_ARRAY" "admins"}}
]
# REPLICATION PACKETS
REPLICATION_PACKETS_DIR = "/data/replication_packets"
# JSON DUMPS
JSON_DUMPS_DIR = "/data/json_dumps"
USE_COMPILED_STYLING = True
DEBUG_TB_INTERCEPT_REDIRECTS = False
OAUTH2_BLUEPRINT_PREFIX = "/new-oauth2"
OAUTH2_ACCESS_TOKEN_GENERATOR = "oauth.generator.create_access_token"
OAUTH2_REFRESH_TOKEN_GENERATOR = "oauth.generator.create_refresh_token"
OAUTH2_TOKEN_EXPIRES_IN = {
"authorization_code": 3600,
"implicit": 3600,
}
OAUTH2_AUTHORIZATION_CODE_EXPIRES_IN = 600