mirror of
https://github.com/Mailu/Mailu.git
synced 2025-06-04 23:27:34 +02:00
Moved parsing environment variable to global application config dictionary
Per requested changes added the ``DEFAULT_SPAM_THRESHOLD`` to the main application configuration dictionary in ``configuration.py`` and updated ``models.py`` accordingly. No error handling is added, as that was not required.
This commit is contained in:
parent
4da0ff1856
commit
82860d0f80
@ -75,6 +75,7 @@ DEFAULT_CONFIG = {
|
|||||||
'SESSION_COOKIE_SECURE': True,
|
'SESSION_COOKIE_SECURE': True,
|
||||||
'CREDENTIAL_ROUNDS': 12,
|
'CREDENTIAL_ROUNDS': 12,
|
||||||
'TZ': 'Etc/UTC',
|
'TZ': 'Etc/UTC',
|
||||||
|
'DEFAULT_SPAM_THRESHOLD': 80,
|
||||||
# Host settings
|
# Host settings
|
||||||
'HOST_IMAP': 'imap',
|
'HOST_IMAP': 'imap',
|
||||||
'HOST_LMTP': 'imap:2525',
|
'HOST_LMTP': 'imap:2525',
|
||||||
@ -163,6 +164,7 @@ class ConfigManager:
|
|||||||
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])
|
||||||
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'])
|
||||||
|
|
||||||
# update the app config
|
# update the app config
|
||||||
app.config.update(self.config)
|
app.config.update(self.config)
|
||||||
|
@ -509,8 +509,7 @@ class User(Base, Email):
|
|||||||
displayed_name = db.Column(db.String(160), nullable=False, default='')
|
displayed_name = db.Column(db.String(160), nullable=False, default='')
|
||||||
spam_enabled = db.Column(db.Boolean, nullable=False, default=True)
|
spam_enabled = db.Column(db.Boolean, nullable=False, default=True)
|
||||||
spam_mark_as_read = db.Column(db.Boolean, nullable=False, default=True)
|
spam_mark_as_read = db.Column(db.Boolean, nullable=False, default=True)
|
||||||
spam_threshold = db.Column(db.Integer, nullable=False,
|
spam_threshold = db.Column(db.Integer, nullable=False, default=app.config['DEFAULT_SPAM_THRESHOLD'])
|
||||||
default=int(os.environ.get('DEFAULT_SPAM_THRESHOLD', 80)))
|
|
||||||
|
|
||||||
# Flask-login attributes
|
# Flask-login attributes
|
||||||
is_authenticated = True
|
is_authenticated = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user