import os


class BaseConfig(object):

  # Application settings
  APP_NAME = "Certificate Authority web app"
  
  # DO NOT use Unsecure Secrets in production environments
  # Generate a safe one with:
  #     python -c "import os; print repr(os.urandom(24));"
  SECRET_KEY = 'This is an UNSECURE Secret. CHANGE THIS for production environments.'
  
  # SQLAlchemy settings
  SQLALCHEMY_DATABASE_URI = 'sqlite:///ca.db'
  SQLALCHEMY_TRACK_MODIFICATIONS = False
  CSRF_ENABLED = True
  
  # Flask-Mail settings
  # For smtp.gmail.com to work, you MUST set "Allow less secure apps" to ON in Google Accounts.
  # Change it in https://myaccount.google.com/security#connectedapps (near the bottom).
  MAIL_SERVER = 'smtp.gmail.com'
  MAIL_PORT = 587
  MAIL_USE_SSL = False
  MAIL_USE_TLS = True
  MAIL_USERNAME = 'yourname@gmail.com'
  MAIL_PASSWORD = 'password'
  MAIL_DEFAULT_SENDER = '"Your Name" <yourname@gmail.com>'
  
  # Used by email templates
  USER_APP_NAME             = "Certificate Authority"
  
  # Internal view application
  USER_AFTER_LOGIN_ENDPOINT = ''
  USER_AFTER_LOGOUT_ENDPOINT = ''
  USER_ENABLE_USERNAME = True
  USER_ENABLE_EMAIL = False
  USER_ENABLE_REGISTRATION = False
  USER_ENABLE_CHANGE_USERNAME = False
  
  # Allowed digest for signature
  CA_DIGEST_LIST = ['sha256', 'sha384', 'sha512']


class Development(BaseConfig):
  DEBUG = True
  TESTING = True

class Production(BaseConfig):
  # DO NOT use "DEBUG = True" in production environments
  DEBUG = False
  TESTING = False