fix(config): now loading config from env correctly
This commit is contained in:
31
app/config.py
Normal file
31
app/config.py
Normal file
@@ -0,0 +1,31 @@
|
||||
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
|
||||
Reference in New Issue
Block a user