-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.py
66 lines (46 loc) · 1.94 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
from os import environ, path, urandom
from dotenv import load_dotenv
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, ".env"))
class Config:
"""Base config"""
FLASK_APP = "wsgi.py"
SECRET_KEY = environ.get("SECRET_KEY", urandom(16))
SQLALCHEMY_TRACK_MODIFICATIONS = False
class DevConfig(Config):
DEBUG = True
TESTING = True
SERVER_NAME = environ.get("SERVER_NAME")
POSTGRES_NAME = environ.get("POSTGRES_NAME", "wizardchess") # DB Name
POSTGRES_USER = environ.get("POSTGRES_USER", "postgres")
POSTGRES_PASSWORD = environ.get("POSTGRES_PASSWORD", "postgres")
POSTGRES_HOST = environ.get("POSTGRES_HOST", "localhost")
POSTGRES_PORT = environ.get("POSTGRES_PORT", "5432")
SQLALCHEMY_DATABASE_URI = environ.get(
"DATABASE_URL",
f"postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}"
f":{POSTGRES_PORT}/{POSTGRES_NAME}",
)
IMG_DIR = path.join(basedir, "dev-imgdir")
ENGINE_PATH = environ.get("DEV_ENGINE_PATH", "stockfish")
class ProdConfig(Config):
DEBUG = False
TESTING = False
SERVER_NAME = environ.get("SERVER_NAME")
SQLALCHEMY_DATABASE_URI = environ.get("DATABASE_URL")
IMG_DIR = path.join(basedir, environ.get("IMG_DIR", "imgdir"))
ENGINE_PATH = environ.get("ENGINE_PATH")
class TestConfig(Config):
DEBUG = False
TESTING = True
POSTGRES_NAME = environ.get("POSTGRES_NAME", "wizardchess") # DB Name
POSTGRES_USER = environ.get("POSTGRES_USER", "postgres")
POSTGRES_PASSWORD = environ.get("POSTGRES_PASSWORD", "postgres")
POSTGRES_HOST = environ.get("POSTGRES_HOST", "localhost")
POSTGRES_PORT = environ.get("POSTGRES_PORT", 5432)
SQLALCHEMY_DATABASE_URI = environ.get(
"DATABASE_URL",
f"postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}"
f":{POSTGRES_PORT}/{POSTGRES_NAME}",
)
ENGINE_PATH = environ.get("ENGINE_PATH", "stockfish")