|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
from mailustart import resolve
|
|
|
|
|
|
|
|
|
|
DEFAULT_CONFIG = {
|
|
|
|
|
# Specific to the admin UI
|
|
|
|
@ -60,7 +60,6 @@ DEFAULT_CONFIG = {
|
|
|
|
|
'POD_ADDRESS_RANGE': None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigManager(dict):
|
|
|
|
|
""" Naive configuration manager that uses environment only
|
|
|
|
|
"""
|
|
|
|
@ -74,6 +73,12 @@ class ConfigManager(dict):
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.config = dict()
|
|
|
|
|
|
|
|
|
|
def resolve_host(self):
|
|
|
|
|
self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])
|
|
|
|
|
self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])
|
|
|
|
|
self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])
|
|
|
|
|
self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])
|
|
|
|
|
|
|
|
|
|
def __coerce_value(self, value):
|
|
|
|
|
if isinstance(value, str) and value.lower() in ('true','yes'):
|
|
|
|
|
return True
|
|
|
|
@ -88,6 +93,7 @@ class ConfigManager(dict):
|
|
|
|
|
key: self.__coerce_value(os.environ.get(key, value))
|
|
|
|
|
for key, value in DEFAULT_CONFIG.items()
|
|
|
|
|
})
|
|
|
|
|
self.resolve_host()
|
|
|
|
|
|
|
|
|
|
# automatically set the sqlalchemy string
|
|
|
|
|
if self.config['DB_FLAVOR']:
|
|
|
|
|