-
Notifications
You must be signed in to change notification settings - Fork 39
/
config.py
37 lines (30 loc) · 1.16 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
"""Flask config and env vars.
https://flask.palletsprojects.com/en/latest/config/
"""
import logging
import os
from oauth_dropins.webutil import appengine_config, appengine_info, util
# This is primarily for flashed messages, since we don't use session data
# otherwise.
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
# Not strict because we flash messages after cross-site redirects for OAuth,
# which strict blocks.
SESSION_COOKIE_SAMESITE = 'Lax'
CACHE_THRESHOLD = 3000
if appengine_info.DEBUG:
ENV = 'development'
CACHE_TYPE = 'NullCache'
SECRET_KEY = 'sooper seekret'
else:
ENV = 'production'
CACHE_TYPE = 'SimpleCache'
SECRET_KEY = util.read('flask_secret_key')
logging.getLogger().setLevel(logging.INFO)
if logging_client := getattr(appengine_config, 'logging_client'):
logging_client.setup_logging(log_level=logging.INFO)
for logger in ('common', 'oauth_dropins.webutil.webmention', 'lexrpc'):
logging.getLogger(logger).setLevel(logging.DEBUG)
os.environ.setdefault('APPVIEW_HOST', 'api.bsky.local')
os.environ.setdefault('BGS_HOST', 'bgs.bsky.local')
os.environ.setdefault('PLC_HOST', 'plc.bsky.local')