CICD/app/config.py
2019-05-18 13:00:13 -04:00

45 lines
1.3 KiB
Python

import os
from typing import List, Type
basedir = os.path.abspath(os.path.dirname(__file__))
class BaseConfig:
CONFIG_NAME = 'base'
USE_MOCK_EQUIVALENCY = False
DEBUG = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
class DevelopmentConfig(BaseConfig):
CONFIG_NAME = 'dev'
SECRET_KEY = os.getenv(
"DEV_SECRET_KEY", "You can't see California without Marlon Widgeto's eyes")
DEBUG = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
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
SQLALCHEMY_TRACK_MODIFICATIONS = False
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
SQLALCHEMY_TRACK_MODIFICATIONS = False
TESTING = False
SQLALCHEMY_DATABASE_URI = "sqlite:///{0}/app-prod.db".format(basedir)
EXPORT_CONFIGS: List[Type[BaseConfig]] = [
DevelopmentConfig, TestingConfig, ProductionConfig]
config_by_name = {cfg.CONFIG_NAME: cfg for cfg in EXPORT_CONFIGS}