2020-02-24 20:22:24 +03:00
|
|
|
import logging
|
2013-03-07 22:29:38 +04:00
|
|
|
import os
|
2022-10-24 16:40:21 +03:00
|
|
|
from typing import Any, Optional
|
2013-03-07 22:29:38 +04:00
|
|
|
|
2020-02-24 20:22:24 +03:00
|
|
|
|
2013-03-07 22:29:38 +04:00
|
|
|
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
2022-10-19 20:51:39 +03:00
|
|
|
def get_flask_template_path() -> str:
|
2022-09-28 19:44:32 +03:00
|
|
|
"""Returns a path to the templates.
|
|
|
|
"""
|
2022-10-19 20:51:39 +03:00
|
|
|
return os.path.join(ROOT_DIR, 'templates')
|
2022-06-12 22:47:13 +03:00
|
|
|
|
2020-02-24 20:22:24 +03:00
|
|
|
# By default, send all email to an archive for debugging.
|
|
|
|
# For the live cr-status server, this setting is None.
|
2022-10-24 16:40:21 +03:00
|
|
|
SEND_ALL_EMAIL_TO: Optional[str] = (
|
|
|
|
'cr-status-staging-emails+%(user)s+%(domain)s@google.com')
|
2020-02-24 20:22:24 +03:00
|
|
|
|
2020-03-14 00:16:07 +03:00
|
|
|
BOUNCE_ESCALATION_ADDR = 'cr-status-bounces@google.com'
|
|
|
|
|
2021-05-04 21:33:29 +03:00
|
|
|
|
|
|
|
# Display a site maintenance banner on every page. Or, an empty string.
|
2021-05-11 21:27:12 +03:00
|
|
|
BANNER_MESSAGE = ''
|
2021-05-04 21:33:29 +03:00
|
|
|
|
|
|
|
# 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.
|
2021-05-11 21:27:12 +03:00
|
|
|
BANNER_TIME = None
|
2021-05-04 21:33:29 +03:00
|
|
|
|
2022-08-18 04:14:19 +03:00
|
|
|
# If a feature entry does not specify a component, use this one.
|
|
|
|
DEFAULT_COMPONENT = 'Blink'
|
|
|
|
|
2023-03-01 19:12:45 +03:00
|
|
|
# The default component for enterprise features.
|
|
|
|
DEFAULT_ENTERPRISE_COMPONENT = 'Enterprise'
|
|
|
|
|
2022-08-18 04:14:19 +03:00
|
|
|
|
2013-03-07 22:29:38 +04:00
|
|
|
################################################################################
|
|
|
|
|
2020-02-24 20:22:24 +03:00
|
|
|
PROD = False
|
2021-01-21 03:21:14 +03:00
|
|
|
STAGING = False
|
2020-02-24 20:22:24 +03:00
|
|
|
DEBUG = True
|
|
|
|
SEND_EMAIL = False # Just log email
|
2021-09-24 21:29:47 +03:00
|
|
|
DEV_MODE = (os.environ['SERVER_SOFTWARE'].startswith('Development') or
|
|
|
|
os.environ.get('GAE_ENV', '').startswith('localdev'))
|
2021-01-16 02:50:36 +03:00
|
|
|
UNIT_TEST_MODE = os.environ['SERVER_SOFTWARE'].startswith('test')
|
|
|
|
|
2021-10-07 22:48:50 +03:00
|
|
|
if not UNIT_TEST_MODE:
|
|
|
|
# Py3 defaults to level WARN.
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
|
|
|
|
|
2021-03-18 20:58:32 +03:00
|
|
|
#setting GOOGLE_CLOUD_PROJECT manually in dev mode
|
|
|
|
if DEV_MODE or UNIT_TEST_MODE:
|
2021-03-19 21:19:57 +03:00
|
|
|
APP_ID = os.environ.get('GOOGLE_CLOUD_PROJECT', 'dev')
|
|
|
|
else:
|
2021-03-18 20:58:32 +03:00
|
|
|
APP_ID = os.environ['GOOGLE_CLOUD_PROJECT']
|
2013-03-07 22:29:38 +04:00
|
|
|
|
2022-08-08 18:33:18 +03:00
|
|
|
SITE_URL = 'https://%s.appspot.com/' % APP_ID
|
2021-01-16 02:50:36 +03:00
|
|
|
CLOUD_TASKS_REGION = 'us-central1'
|
2013-03-07 22:29:38 +04:00
|
|
|
|
2021-05-07 03:29:03 +03:00
|
|
|
GOOGLE_SIGN_IN_CLIENT_ID = (
|
|
|
|
'914217904764-enfcea61q4hqe7ak8kkuteglrbhk8el1.'
|
|
|
|
'apps.googleusercontent.com')
|
|
|
|
|
2021-08-28 04:19:00 +03:00
|
|
|
# This is where the an anon user is redirected if they try to access a
|
|
|
|
# page that requires being signed in.
|
2023-06-09 22:13:12 +03:00
|
|
|
LOGIN_PAGE_URL = '?loginStatus=False'
|
2021-08-28 04:19:00 +03:00
|
|
|
|
2021-09-29 00:57:37 +03:00
|
|
|
INBOUND_EMAIL_ADDR = 'chromestatus@cr-status-staging.appspotmail.com'
|
|
|
|
|
2021-11-23 01:41:00 +03:00
|
|
|
# This is where review comment emails are sent:
|
|
|
|
REVIEW_COMMENT_MAILING_LIST = 'jrobbins-test@googlegroups.com'
|
|
|
|
|
2021-10-07 22:48:50 +03:00
|
|
|
# Truncate some log lines to stay under limits of Google Cloud Logging.
|
|
|
|
MAX_LOG_LINE = 200 * 1000
|
|
|
|
|
2021-08-28 04:19:00 +03:00
|
|
|
|
2021-03-18 20:58:32 +03:00
|
|
|
if UNIT_TEST_MODE:
|
2020-02-24 20:22:24 +03:00
|
|
|
APP_TITLE = 'Local testing'
|
2020-03-30 21:12:00 +03:00
|
|
|
SITE_URL = 'http://127.0.0.1:8888/'
|
2020-12-23 21:46:40 +03:00
|
|
|
elif DEV_MODE:
|
|
|
|
PROD = False
|
|
|
|
APP_TITLE = 'Chrome Status Dev'
|
|
|
|
SITE_URL = 'http://127.0.0.1:8888/'
|
2020-02-24 20:22:24 +03:00
|
|
|
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
|
2022-08-08 18:33:18 +03:00
|
|
|
SITE_URL = 'https://chromestatus.com/'
|
2021-05-08 00:03:08 +03:00
|
|
|
GOOGLE_SIGN_IN_CLIENT_ID = (
|
|
|
|
'999517574127-7ueh2a17bv1ave9thlgtap19pt5qjp4g.'
|
|
|
|
'apps.googleusercontent.com')
|
2021-09-29 00:57:37 +03:00
|
|
|
INBOUND_EMAIL_ADDR = 'chromestatus@cr-status.appspotmail.com'
|
2021-11-23 01:41:00 +03:00
|
|
|
REVIEW_COMMENT_MAILING_LIST = 'blink-dev@chromium.org'
|
2022-07-15 03:04:45 +03:00
|
|
|
BACKUP_BUCKET = 'cr-status-backups'
|
2020-02-24 20:22:24 +03:00
|
|
|
elif APP_ID == 'cr-status-staging':
|
2021-01-21 03:21:14 +03:00
|
|
|
STAGING = True
|
2020-02-24 20:22:24 +03:00
|
|
|
SEND_EMAIL = True
|
|
|
|
APP_TITLE = 'Chrome Platform Status Staging'
|
2022-07-15 03:04:45 +03:00
|
|
|
BACKUP_BUCKET = 'cr-staging-backups'
|
2020-02-24 20:22:24 +03:00
|
|
|
else:
|
|
|
|
logging.error('Unexpected app ID %r, please configure settings.py.', APP_ID)
|
2013-06-28 19:51:44 +04:00
|
|
|
|
2013-06-30 04:44:49 +04:00
|
|
|
RSS_FEED_LIMIT = 15
|
2014-03-24 20:23:22 +04:00
|
|
|
|
2022-09-27 00:25:20 +03:00
|
|
|
DEFAULT_CACHE_TIME = 3600 # seconds
|
2016-09-01 06:17:19 +03:00
|
|
|
|
2019-08-14 21:59:14 +03:00
|
|
|
USE_I18N = False
|
|
|
|
|
2020-02-24 20:22:24 +03:00
|
|
|
TEMPLATE_DEBUG = DEBUG
|
2016-09-01 06:17:19 +03:00
|
|
|
if DEBUG:
|
|
|
|
TEMPLATE_CACHE_TIME = 0
|
|
|
|
else:
|
|
|
|
TEMPLATE_CACHE_TIME = 600 # seconds
|