Files
ldap-interface/app/config.py

38 lines
949 B
Python

"""
A module that is used to store the current app's config
"""
import os
class Config(object):
SECRET_KEY = os.environ.get("SECRET_KEY")
if SECRET_KEY is None:
raise Exception("[!!] No secret key was given")
LDAP_ADDRESS = os.environ.get("LDAP_ADDRESS")
if LDAP_ADDRESS is None:
raise Exception("[!!] No LDAP_ADDRESS was given")
LDAP_PORT = os.environ.get("LDAP_PORT", default=389)
_ldap_tls = os.environ.get("LDAP_TLS", default=False)
LDAP_TLS = _ldap_tls.lower() in {"1", "t", "true"}
BASE_DN = os.environ.get("BASE_DN")
if BASE_DN is None:
raise Exception("[!!] No BASE_DN was given")
CSRF_ENABLED = True
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'None'
class DevelopmentConfig(Config):
TESTING = True
DEBUG = True
DEVELOPMENT = True
class ProductionConfig(Config):
TESTING = False
DEBUG = False