import os

try:
    from local_config import LocalConfig
except ImportError:
    print("   \033[92mWARNING: Local config not found\033[0m")
    class LocalConfig():
        pass


class Config(object):
    SECRET_KEY = os.environ.get('SECRET_KEY') or LocalConfig.SECRET_KEY
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
        'postgresql+psycopg2://' + os.environ.get('USER') + ':@/' \
        + LocalConfig.DB_NAME
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    MAIL_DEFAULT_SENDER = "noreply@v5.planet-casio.com"
    MAIL_SUPPRESS_SEND = None


class DefaultConfig(object):
    """Every value here can be overrided in the local_config.py class"""
    # Domain
    DOMAIN = "v5.planet-casio.com"
    # Database name
    DB_NAME = "pcv5"
    # LDAP usage
    USE_LDAP = False
    # LDAP configuration
    LDAP_PASSWORD = "openldap"
    LDAP_ROOT = "o=planet-casio"
    LDAP_ENV = "o=prod"
    # Secret key used to authenticate tokens. **USE YOURS!**
    SECRET_KEY = "a-random-secret-key"
    # Uploaded data folder
    DATA_FOLDER = '/var/www/uploads'
    # Enable guest post
    ENABLE_GUEST_POST = True
    # Disable email confimation
    ENABLE_EMAIL_CONFIRMATION = True
    # Send emails
    SEND_MAILS = True

class V5Config(LocalConfig, DefaultConfig):
    # Values put here cannot be overidden with local_config
    pass
