-
Notifications
You must be signed in to change notification settings - Fork 376
/
settings.py
143 lines (109 loc) · 4.42 KB
/
settings.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
138
139
140
141
142
143
import logging
import os
from framework.secrets import get_ot_api_key
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
def get_flask_template_path() -> str:
"""Returns a path to the templates.
"""
return os.path.join(ROOT_DIR, 'templates')
# By default, send all email to an archive for debugging.
# For the live cr-status server, this setting is None.
SEND_ALL_EMAIL_TO: str|None = (
'cr-status-staging-emails+%(user)s+%(domain)[email protected]')
# Any emails with Cc addresses will instead be sent this group
# for non-prod environments.
CC_ALL_EMAIL_TO: str|None = (
'cr-status-staging-cc-emails+%(user)s+%(domain)[email protected]')
BOUNCE_ESCALATION_ADDR = '[email protected]'
# Display a site maintenance banner on every page. Or, an empty string.
BANNER_MESSAGE = ''
# Timestamp used to notify users when the read only mode or other status
# described in the banner message takes effect. Or, None. It is
# expressed as a tuple of ints: (year, month, day[, hour[, minute[, second]]])
# e.g. (2009, 3, 20, 21, 45) represents March 20 2009 9:45PM UTC.
BANNER_TIME = None
# If a feature entry does not specify a component, use this one.
DEFAULT_COMPONENT = 'Blink'
# The default component for enterprise features.
DEFAULT_ENTERPRISE_COMPONENT = 'Enterprise'
# Enable to activate the automated OT creation process
AUTOMATED_OT_CREATION = True
################################################################################
PROD = False
STAGING = False
DEBUG = True
SEND_EMAIL = False # Just log email
DEV_MODE = (os.environ['SERVER_SOFTWARE'].startswith('Development') or
os.environ.get('GAE_ENV', '').startswith('localdev'))
UNIT_TEST_MODE = os.environ['SERVER_SOFTWARE'].startswith('test')
if not UNIT_TEST_MODE:
# Py3 defaults to level WARN.
logging.basicConfig(level=logging.INFO)
#setting GOOGLE_CLOUD_PROJECT manually in dev mode
if DEV_MODE or UNIT_TEST_MODE:
APP_ID = os.environ.get('GOOGLE_CLOUD_PROJECT', 'dev')
else:
APP_ID = os.environ['GOOGLE_CLOUD_PROJECT']
SITE_URL = 'https://%s.appspot.com/' % APP_ID
CLOUD_TASKS_REGION = 'us-central1'
GOOGLE_SIGN_IN_CLIENT_ID = (
'914217904764-enfcea61q4hqe7ak8kkuteglrbhk8el1.'
'apps.googleusercontent.com')
# This is where the an anon user is redirected if they try to access a
# page that requires being signed in.
LOGIN_PAGE_URL = '?loginStatus=False'
INBOUND_EMAIL_ADDR = '[email protected]'
# This is where review comment emails are sent:
REVIEW_COMMENT_MAILING_LIST = '[email protected]'
# Truncate some log lines to stay under limits of Google Cloud Logging.
MAX_LOG_LINE = 200 * 1000
# Largest individual attachment / screenshot that the user can POST.
MAX_ATTACHMENT_SIZE = 1 * 1024 * 1024
# Largest overall POST to any handler.
MAX_REQUEST_CONTENT_LENGTH = 16 * 1024 * 1024
# Origin trials API URL
OT_URL = 'https://origintrials-staging.corp.google.com/origintrials/'
OT_API_URL = 'https://staging-chromeorigintrials-pa.sandbox.googleapis.com'
# Values are set later when request is needed.
OT_API_KEY: str|None = None
OT_DATA_ACCESS_ADMIN_GROUP_NAME: str|None = None
# Dummy data for local OT support emails.
DEV_MODE_OT_SUPPORT_EMAILS = '[email protected],[email protected]'
if UNIT_TEST_MODE:
APP_TITLE = 'Local testing'
SITE_URL = 'http://127.0.0.1:7777/'
elif DEV_MODE:
PROD = False
APP_TITLE = 'Chrome Status Dev'
SITE_URL = 'http://127.0.0.1:7777/'
elif APP_ID == 'cr-status':
PROD = True
DEBUG = False
APP_TITLE = 'Chrome Platform Status'
SEND_EMAIL = True
SEND_ALL_EMAIL_TO = None # Deliver it to the intended users
CC_ALL_EMAIL_TO = None
SITE_URL = 'https://chromestatus.com/'
OT_URL = 'https://developer.chrome.com/origintrials/'
OT_API_URL = 'https://chromeorigintrials-pa.googleapis.com'
GOOGLE_SIGN_IN_CLIENT_ID = (
'999517574127-7ueh2a17bv1ave9thlgtap19pt5qjp4g.'
'apps.googleusercontent.com')
INBOUND_EMAIL_ADDR = '[email protected]'
REVIEW_COMMENT_MAILING_LIST = '[email protected]'
BACKUP_BUCKET = 'cr-status-backups'
elif APP_ID == 'cr-status-staging':
STAGING = True
SEND_EMAIL = True
APP_TITLE = 'Chrome Platform Status Staging'
BACKUP_BUCKET = 'cr-staging-backups'
else:
logging.error('Unexpected app ID %r, please configure settings.py.', APP_ID)
RSS_FEED_LIMIT = 15
DEFAULT_CACHE_TIME = 3600 # seconds
USE_I18N = False
TEMPLATE_DEBUG = DEBUG
if DEBUG:
TEMPLATE_CACHE_TIME = 0
else:
TEMPLATE_CACHE_TIME = 600 # seconds