-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.py
118 lines (86 loc) · 3.49 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
import os
class Config(object):
SECRET_KEY = os.environ.get("SECRET_KEY")
PREFERRED_URL_SCHEME = "https"
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_DATABASE_URI = os.environ.get("DB_STRING")
APP_STATE = os.environ.get("APP_STATE") # production, development, debug, shutdown
SECURITY_PASSWORD_SALT = os.environ.get("SECURITY_PASSWORD_SALT")
SECURITY_REGISTERABLE = True
SECURITY_SEND_REGISTER_EMAIL = False
SECURITY_CONFIRMABLE = False
SECURITY_CHANGEABLE = True
SECURITY_SEND_PASSWORD_CHANGE_EMAIL = False
SECURITY_RECOVERABLE = True
SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = (
"Žádost o reset hesla do Skautské kuchařky" # nosec
)
SECURITY_SEND_PASSWORD_RESET_NOTICE_EMAIL = False
SECURITY_MSG_INVALID_EMAIL_ADDRESS = ("neplatná e-mailová adresa", "error")
SECURITY_MSG_EMAIL_NOT_PROVIDED = ("zadej e-mailovou adresu", "error")
SECURITY_MSG_RETYPE_PASSWORD_MISMATCH = ("hesla se neshodují", "error")
SECURITY_MSG_PASSWORD_INVALID_LENGTH = (
"heslo je příliš krátké, musí mít alespoň 8 znaků",
"error",
)
SECURITY_MSG_EMAIL_ALREADY_ASSOCIATED = (
"e-mail už je použit, chceš se přihlásit?",
"error",
)
SECURITY_MSG_INVALID_PASSWORD = ("špatné heslo", "error")
SECURITY_MSG_USER_DOES_NOT_EXIST = ("uživatel neexistuje", "error")
SECURITY_MSG_LOGIN = ("nejdřív se přihlas", "warning")
SECURITY_MSG_PASSWORD_RESET_REQUEST = (
"poslali jsme ti instrukce k nastavení nového hesla na %(email)s",
"success",
)
# SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = "Vaše heslo do Skautské kuchařky bylo resetováno."
# TURBO_WEBSOCKET_ROUTE = None
MAIL_SERVER = "smtp.googlemail.com"
MAIL_PORT = 465
MAIL_USE_SSL = True
# MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get("MAIL_USERNAME")
MAIL_PASSWORD = os.environ.get("MAIL_PASSWORD")
GOOGLE_OAUTH_CLIENT_ID = os.environ.get("GOOGLE_OAUTH_CLIENT_ID")
GOOGLE_OAUTH_CLIENT_SECRET = os.environ.get("GOOGLE_OAUTH_CLIENT_SECRET")
STORAGE_SYSTEM = os.getenv("STORAGE_SYSTEM", "LOCAL")
PASSWORDLESS_URL = "https://v4.passwordless.dev"
PASSWORDLESS_KEY = "skautskkuchaka:public:36bd9184a88e4a05a2db8af12a2f87d4"
PASSWORDLESS_SECRET = os.getenv("PASSWORDLESS_SECRET")
SENTRY_MONITORING = True
INFO_USED_DB = "production db"
FF_GALLERY = os.getenv("FF_GALLERY", False)
FF_GOOGLE_OAUTH = os.getenv("FF_GOOGLE_OAUTH", True)
SYSTEM_MESSAGE = os.getenv("SYSTEM_MESSAGE", None)
class LocalProdConfig(Config):
INFO_USED_DB = "production db"
TEMPLATES_AUTO_RELOAD = True
class DevConfig(LocalProdConfig):
TEMPLATES_AUTO_RELOAD = True
SENTRY_MONITORING = False
INFO_USED_DB = "local db"
FLASK_DEBUG = True
DEV_PASSWORD = os.environ.get("DEV_PASSWORD")
# SQLALCHEMY_ECHO = True
# EXPLAIN_TEMPLATE_LOADING = True
class TestConfig(Config):
TESTING = True
WTF_CSRF_ENABLED = False
SENTRY_MONITORING = False
FLASK_DEBUG = False
SQLALCHEMY_DATABASE_URI = os.environ.get("TEST_DB_STRING")
SECRET_KEY = "justtesting" # nosec
SECURITY_PASSWORD_SALT = "justtesting" # nosec
INFO_USED_DB = "testing db"
class ProdConfig(Config):
INFO_USED_DB = "production db"
FLASK_ENV = "production"
configs = {
"development": DevConfig,
"test": TestConfig,
"testing": TestConfig,
"production": ProdConfig,
"local_production": LocalProdConfig,
"default": ProdConfig,
}