import os
from decouple import config
import yaml

conf = yaml.safe_load(open('conf.yml'))
conf = conf["app"]


class Config(object):
    basedir = os.path.abspath(os.path.dirname(__file__))

    # Set up the App SECRET_KEY
    SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_007')

    # Credenciales BBDD
    db_params = conf["db_parameters"]

    # TimeZone
    timezone = conf["timezone"]
    time_pattern = conf["time_pattern"]

    # Logging level
    logging_level = conf["logging"]

    # Max threads allowed
    max_engine_threads = conf["max_engine_threads"]


class ProductionConfig(Config):
    DEBUG = False
    # Security
    SESSION_COOKIE_HTTPONLY = True
    REMEMBER_COOKIE_HTTPONLY = True
    REMEMBER_COOKIE_DURATION = 3600


class DebugConfig(Config):
    DEBUG = True


# Load all possible configurations
config_dict = {
    'Production': ProductionConfig,
    'Debug': DebugConfig
}
