CICD/app/config.py

49 lines
1.3 KiB
Python
Raw Permalink Normal View History

2019-05-18 17:22:18 +02:00
import os
2019-05-18 19:00:13 +02:00
from typing import List, Type
2019-05-18 17:22:18 +02:00
basedir = os.path.abspath(os.path.dirname(__file__))
class BaseConfig:
2019-08-03 18:55:38 +02:00
CONFIG_NAME = "base"
2019-05-18 17:22:18 +02:00
USE_MOCK_EQUIVALENCY = False
DEBUG = False
2019-05-18 19:00:13 +02:00
SQLALCHEMY_TRACK_MODIFICATIONS = False
2019-05-18 17:22:18 +02:00
class DevelopmentConfig(BaseConfig):
2019-08-03 18:55:38 +02:00
CONFIG_NAME = "dev"
2019-05-18 17:22:18 +02:00
SECRET_KEY = os.getenv(
2019-08-03 18:55:38 +02:00
"DEV_SECRET_KEY", "You can't see California without Marlon Widgeto's eyes"
)
2019-05-18 17:22:18 +02:00
DEBUG = True
2019-05-18 19:00:13 +02:00
SQLALCHEMY_TRACK_MODIFICATIONS = False
2019-05-18 17:22:18 +02:00
TESTING = False
SQLALCHEMY_DATABASE_URI = "sqlite:///{0}/app-dev.db".format(basedir)
class TestingConfig(BaseConfig):
2019-08-03 18:55:38 +02:00
CONFIG_NAME = "test"
2019-05-18 17:22:18 +02:00
SECRET_KEY = os.getenv("TEST_SECRET_KEY", "Thanos did nothing wrong")
DEBUG = True
2019-05-18 19:00:13 +02:00
SQLALCHEMY_TRACK_MODIFICATIONS = False
2019-05-18 17:22:18 +02:00
TESTING = True
SQLALCHEMY_DATABASE_URI = "sqlite:///{0}/app-test.db".format(basedir)
class ProductionConfig(BaseConfig):
2019-08-03 18:55:38 +02:00
CONFIG_NAME = "prod"
2019-05-18 17:22:18 +02:00
SECRET_KEY = os.getenv("PROD_SECRET_KEY", "I'm Ron Burgundy?")
DEBUG = False
2019-05-18 19:00:13 +02:00
SQLALCHEMY_TRACK_MODIFICATIONS = False
2019-05-18 17:22:18 +02:00
TESTING = False
SQLALCHEMY_DATABASE_URI = "sqlite:///{0}/app-prod.db".format(basedir)
2019-05-18 19:00:13 +02:00
EXPORT_CONFIGS: List[Type[BaseConfig]] = [
2019-08-03 18:55:38 +02:00
DevelopmentConfig,
TestingConfig,
ProductionConfig,
]
2019-05-18 17:22:18 +02:00
config_by_name = {cfg.CONFIG_NAME: cfg for cfg in EXPORT_CONFIGS}