|
|
@ -11,7 +11,6 @@ DEFAULT_CONFIG = {
|
|
|
|
'BABEL_DEFAULT_TIMEZONE': 'UTC',
|
|
|
|
'BABEL_DEFAULT_TIMEZONE': 'UTC',
|
|
|
|
'BOOTSTRAP_SERVE_LOCAL': True,
|
|
|
|
'BOOTSTRAP_SERVE_LOCAL': True,
|
|
|
|
'RATELIMIT_STORAGE_URL': '',
|
|
|
|
'RATELIMIT_STORAGE_URL': '',
|
|
|
|
'QUOTA_STORAGE_URL': '',
|
|
|
|
|
|
|
|
'DEBUG': False,
|
|
|
|
'DEBUG': False,
|
|
|
|
'DEBUG_PROFILER': False,
|
|
|
|
'DEBUG_PROFILER': False,
|
|
|
|
'DEBUG_ASSETS': '',
|
|
|
|
'DEBUG_ASSETS': '',
|
|
|
@ -151,9 +150,9 @@ class ConfigManager:
|
|
|
|
template = self.DB_TEMPLATES[self.config['DB_FLAVOR']]
|
|
|
|
template = self.DB_TEMPLATES[self.config['DB_FLAVOR']]
|
|
|
|
self.config['SQLALCHEMY_DATABASE_URI'] = template.format(**self.config)
|
|
|
|
self.config['SQLALCHEMY_DATABASE_URI'] = template.format(**self.config)
|
|
|
|
|
|
|
|
|
|
|
|
# remove? self.config['QUOTA_STORAGE_URL'] = f'redis://{self.config["REDIS_ADDRESS"]}/1'
|
|
|
|
|
|
|
|
if not self.config.get('RATELIMIT_STORAGE_URL'):
|
|
|
|
if not self.config.get('RATELIMIT_STORAGE_URL'):
|
|
|
|
self.config['RATELIMIT_STORAGE_URL'] = f'redis://{self.config["REDIS_ADDRESS"]}/2'
|
|
|
|
self.config['RATELIMIT_STORAGE_URL'] = f'redis://{self.config["REDIS_ADDRESS"]}/2'
|
|
|
|
|
|
|
|
|
|
|
|
self.config['SESSION_STORAGE_URL'] = f'redis://{self.config["REDIS_ADDRESS"]}/3'
|
|
|
|
self.config['SESSION_STORAGE_URL'] = f'redis://{self.config["REDIS_ADDRESS"]}/3'
|
|
|
|
self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
|
|
|
|
self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
|
|
|
|
self.config['SESSION_COOKIE_HTTPONLY'] = True
|
|
|
|
self.config['SESSION_COOKIE_HTTPONLY'] = True
|
|
|
@ -162,9 +161,9 @@ class ConfigManager:
|
|
|
|
self.config['PERMANENT_SESSION_LIFETIME'] = int(self.config['PERMANENT_SESSION_LIFETIME'])
|
|
|
|
self.config['PERMANENT_SESSION_LIFETIME'] = int(self.config['PERMANENT_SESSION_LIFETIME'])
|
|
|
|
self.config['AUTH_RATELIMIT_IP_V4_MASK'] = int(self.config['AUTH_RATELIMIT_IP_V4_MASK'])
|
|
|
|
self.config['AUTH_RATELIMIT_IP_V4_MASK'] = int(self.config['AUTH_RATELIMIT_IP_V4_MASK'])
|
|
|
|
self.config['AUTH_RATELIMIT_IP_V6_MASK'] = int(self.config['AUTH_RATELIMIT_IP_V6_MASK'])
|
|
|
|
self.config['AUTH_RATELIMIT_IP_V6_MASK'] = int(self.config['AUTH_RATELIMIT_IP_V6_MASK'])
|
|
|
|
hostnames = [host.strip() for host in self.config['HOSTNAMES'].split(',')]
|
|
|
|
|
|
|
|
self.config['AUTH_RATELIMIT_EXEMPTION'] = set(ipaddress.ip_network(cidr, False) for cidr in (cidr.strip() for cidr in self.config['AUTH_RATELIMIT_EXEMPTION'].split(',')) if cidr)
|
|
|
|
self.config['AUTH_RATELIMIT_EXEMPTION'] = set(ipaddress.ip_network(cidr, False) for cidr in (cidr.strip() for cidr in self.config['AUTH_RATELIMIT_EXEMPTION'].split(',')) if cidr)
|
|
|
|
self.config['MESSAGE_RATELIMIT_EXEMPTION'] = set([s for s in self.config['MESSAGE_RATELIMIT_EXEMPTION'].lower().replace(' ', '').split(',') if s])
|
|
|
|
self.config['MESSAGE_RATELIMIT_EXEMPTION'] = set([s for s in self.config['MESSAGE_RATELIMIT_EXEMPTION'].lower().replace(' ', '').split(',') if s])
|
|
|
|
|
|
|
|
hostnames = [host.strip() for host in self.config['HOSTNAMES'].split(',')]
|
|
|
|
self.config['HOSTNAMES'] = ','.join(hostnames)
|
|
|
|
self.config['HOSTNAMES'] = ','.join(hostnames)
|
|
|
|
self.config['HOSTNAME'] = hostnames[0]
|
|
|
|
self.config['HOSTNAME'] = hostnames[0]
|
|
|
|
self.config['DEFAULT_SPAM_THRESHOLD'] = int(self.config['DEFAULT_SPAM_THRESHOLD'])
|
|
|
|
self.config['DEFAULT_SPAM_THRESHOLD'] = int(self.config['DEFAULT_SPAM_THRESHOLD'])
|
|
|
|