-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
executable file
·36 lines (29 loc) · 1.01 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
import os
class Config(object):
"""Base config. Used in Production."""
DEBUG = False
TESTING = False
CSRF_ENABLED = True
# From ENV variables
SECRET_KEY = os.getenv("FLASK_SECRET_KEY") or "this-really-needs-to-be-changed"
BASIC_AUTH_USERNAME = os.getenv("BASIC_AUTH_USERNAME")
BASIC_AUTH_PASSWORD = os.getenv("BASIC_AUTH_PASSWORD")
WEBHOOK_URL = os.getenv('WEBHOOK_URL')
REDIS_URL = os.getenv("REDIS_URL")
CORS_ORIGINS = os.getenv("CORS_ORIGINS", "").split(",")
RATELIMIT_KEY_PREFIX = "ratelimit"
RATELIMIT_STORAGE_URL = REDIS_URL
class Develop(Config):
from dotenv import load_dotenv
load_dotenv(verbose=True)
REDIS_URL = "redis://redis"
RATELIMIT_STORAGE_URL = "memory://"
class Testing(Config):
DEBUG = True
TESTING = True
SECRET_KEY = "mysecretkey"
BASIC_AUTH_USERNAME = "myusername"
BASIC_AUTH_PASSWORD = "mypassword"
WEBHOOK_URL = "https://example.com/webhook"
RATELIMIT_ENABLED = False
RATELIMIT_STORAGE_URL = "memory://"