CICD/app/config.py

45 lines
1.3 KiB
Python
Raw 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-05-18 19:00:13 +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):
CONFIG_NAME = 'dev'
SECRET_KEY = os.getenv(
2019-05-18 19:00:13 +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):
CONFIG_NAME = 'test'
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):
CONFIG_NAME = 'prod'
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]] = [
DevelopmentConfig, TestingConfig, ProductionConfig]
2019-05-18 17:22:18 +02:00
config_by_name = {cfg.CONFIG_NAME: cfg for cfg in EXPORT_CONFIGS}