2018-12-30 21:38:05 +01:00
|
|
|
import os
|
2020-09-19 02:38:52 +02:00
|
|
|
import random
|
|
|
|
import string
|
|
|
|
import base64
|
2020-01-31 20:52:59 +01:00
|
|
|
from ast import literal_eval
|
|
|
|
|
2018-12-30 21:38:05 +01:00
|
|
|
_basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
CORS = os.environ.get("CORS") == "True"
|
|
|
|
debug = os.environ.get("DEBUG") == "True"
|
|
|
|
|
|
|
|
|
2020-09-19 02:38:52 +02:00
|
|
|
def get_random_secret(length):
|
2020-09-19 06:58:53 +02:00
|
|
|
secret_key = ''.join(random.choice(string.ascii_uppercase) for x in range(round(length / 4)))
|
|
|
|
secret_key = secret_key + ''.join(random.choice("~!@#$%^&*()_+") for x in range(round(length / 4)))
|
|
|
|
secret_key = secret_key + ''.join(random.choice(string.ascii_lowercase) for x in range(round(length / 4)))
|
|
|
|
return secret_key + ''.join(random.choice(string.digits) for x in range(round(length / 4))) soi
|
2020-09-19 02:38:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
SECRET_KEY = repr(os.environ.get('SECRET_KEY', get_random_secret(32).encode('utf8')))
|
|
|
|
|
|
|
|
LEMUR_TOKEN_SECRET = repr(os.environ.get('LEMUR_TOKEN_SECRET',
|
|
|
|
base64.b64encode(get_random_secret(32).encode('utf8'))))
|
|
|
|
LEMUR_ENCRYPTION_KEYS = repr(os.environ.get('LEMUR_ENCRYPTION_KEYS',
|
|
|
|
base64.b64encode(get_random_secret(32).encode('utf8'))))
|
2018-12-30 21:38:05 +01:00
|
|
|
|
|
|
|
LEMUR_WHITELISTED_DOMAINS = []
|
|
|
|
|
|
|
|
LEMUR_EMAIL = ''
|
|
|
|
LEMUR_SECURITY_TEAM_EMAIL = []
|
|
|
|
|
2020-03-10 11:46:59 +01:00
|
|
|
ALLOW_CERT_DELETION = os.environ.get('ALLOW_CERT_DELETION') == "True"
|
2018-12-30 21:38:05 +01:00
|
|
|
|
2020-02-05 17:11:36 +01:00
|
|
|
LEMUR_DEFAULT_COUNTRY = str(os.environ.get('LEMUR_DEFAULT_COUNTRY',''))
|
|
|
|
LEMUR_DEFAULT_STATE = str(os.environ.get('LEMUR_DEFAULT_STATE',''))
|
|
|
|
LEMUR_DEFAULT_LOCATION = str(os.environ.get('LEMUR_DEFAULT_LOCATION',''))
|
|
|
|
LEMUR_DEFAULT_ORGANIZATION = str(os.environ.get('LEMUR_DEFAULT_ORGANIZATION',''))
|
|
|
|
LEMUR_DEFAULT_ORGANIZATIONAL_UNIT = str(os.environ.get('LEMUR_DEFAULT_ORGANIZATIONAL_UNIT',''))
|
|
|
|
|
|
|
|
LEMUR_DEFAULT_ISSUER_PLUGIN = str(os.environ.get('LEMUR_DEFAULT_ISSUER_PLUGIN',''))
|
|
|
|
LEMUR_DEFAULT_AUTHORITY = str(os.environ.get('LEMUR_DEFAULT_AUTHORITY',''))
|
2018-12-30 21:38:05 +01:00
|
|
|
|
|
|
|
ACTIVE_PROVIDERS = []
|
|
|
|
|
|
|
|
METRIC_PROVIDERS = []
|
|
|
|
|
|
|
|
LOG_LEVEL = str(os.environ.get('LOG_LEVEL','DEBUG'))
|
2018-12-30 22:46:41 +01:00
|
|
|
LOG_FILE = str(os.environ.get('LOG_FILE','/home/lemur/.lemur/lemur.log'))
|
2018-12-30 21:38:05 +01:00
|
|
|
|
|
|
|
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI','postgresql://lemur:lemur@localhost:5432/lemur')
|
2020-01-31 20:52:59 +01:00
|
|
|
|
|
|
|
LDAP_DEBUG = os.environ.get('LDAP_DEBUG') == "True"
|
|
|
|
LDAP_AUTH = os.environ.get('LDAP_AUTH') == "True"
|
|
|
|
LDAP_IS_ACTIVE_DIRECTORY = os.environ.get('LDAP_IS_ACTIVE_DIRECTORY') == "True"
|
|
|
|
LDAP_BIND_URI = str(os.environ.get('LDAP_BIND_URI',''))
|
|
|
|
LDAP_BASE_DN = str(os.environ.get('LDAP_BASE_DN',''))
|
|
|
|
LDAP_EMAIL_DOMAIN = str(os.environ.get('LDAP_EMAIL_DOMAIN',''))
|
|
|
|
LDAP_USE_TLS = str(os.environ.get('LDAP_USE_TLS',''))
|
|
|
|
LDAP_REQUIRED_GROUP = str(os.environ.get('LDAP_REQUIRED_GROUP',''))
|
|
|
|
LDAP_GROUPS_TO_ROLES = literal_eval(os.environ.get('LDAP_GROUPS_TO_ROLES') or "{}")
|