-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
73 lines (57 loc) · 2.03 KB
/
config.py
File metadata and controls
73 lines (57 loc) · 2.03 KB
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
"""
Configuration for the flask app
"""
import os
import urllib.parse
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
"""
Base configuration class. Contains default settings and settings applicable to all environments.
"""
# Default settings
TESTING = False
WTF_CSRF_ENABLED = True
# Settings applicable to all environments
NAME = "Codex"
SECRET_KEY = os.environ.get(
"SECRET_KEY", default="8398d0d1c238e783b22015ef285b01ef1dccd277fbef4d436592d9a3c89c1e75"
) # Can generate a new one with secrets.token_hex()
# Database
username = urllib.parse.quote_plus(os.environ.get("MONGO_USER", default="dev"))
password = urllib.parse.quote_plus(os.environ.get("MONGO_PASSWORD", default="codex-1240"))
MONGO_URI = os.environ.get("MONGO_URI", default="mongodb://{}:{}@localhost:27017/")
MONGO_URI = MONGO_URI.format(username, password)
# File uploads (we don't actually save any files)
UPLOADED_INPUTS_DEST = os.environ.get("UPLOADED_INPUTS_DEST", default="temp_inputs")
# API
# TODO: update versions and CDN and all that
API_TITLE = "Codex API"
API_VERSION = "v0"
OPENAPI_VERSION = "3.0.2"
OPENAPI_URL_PREFIX = "/api"
OPENAPI_SWAGGER_UI_PATH = "/swagger-ui"
OPENAPI_SWAGGER_UI_URL = "https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/3.24.2/"
OPENAPI_REDOC_PATH = "/redoc"
OPENAPI_REDOC_URL = (
"https://cdn.jsdelivr.net/npm/redoc@2.0.0-alpha.17/bundles/redoc.standalone.js"
)
OPENAPI_RAPIDOC_PATH = "/rapidoc"
OPENAPI_RAPIDOC_URL = "https://cdn.jsdelivr.net/npm/rapidoc@9.0.0/dist/rapidoc-min.js"
class DevelopmentConfig(Config):
"""
Configuration for development environment
"""
NAME = "Codex.DEV"
LOG_LEVEL = "DEBUG"
class TestingConfig(Config):
"""
Configuration for testing environment
"""
TESTING = True
WTF_CSRF_ENABLED = False
LOG_LEVEL = "INFO"
class ProductionConfig(Config):
"""
Configuration for production environment
"""
LOG_LEVEL = "INFO"