prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Admin whitelist_webmail hard coded
  Hi,
  I'm trying to send transactional email with Mailu SMTP from a backend server and it takes more than 15s.
  I tracked down one problem in core/admin/mailu/internal/__init__.py:
  def whitelist_webmail() uses socket.gethostbyname("webmail")
  
  In my docker configuration there is no "webmail" host so the function socket.gethostbyname return nothing after 5s which slows down a lot the request /internal/auth/email
  When I set "webmail" to a fake ip on the admin server the /internal/auth/email returns immediately.
  
  Maybe it would be better to define a list of hostnames in the configuration file instead of using a hard coded "webmail" value. What do you think?
  
  Thanks Mailu for the great work!
  JB
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `core/admin/mailu/internal/__init__.py`
  Content:
  ```
  1 from flask_limiter import RateLimitExceeded
  2 
  3 from mailu import utils
  4 
  5 import socket
  6 import flask
  7 
  8 
  9 internal = flask.Blueprint('internal', __name__, template_folder='templates')
  10 
  11 
  12 @internal.app_errorhandler(RateLimitExceeded)
  13 def rate_limit_handler(e):
  14     response = flask.Response()
  15     response.headers['Auth-Status'] = 'Authentication rate limit from one source exceeded'
  16     response.headers['Auth-Error-Code'] = '451 4.3.2'
  17     if int(flask.request.headers['Auth-Login-Attempt']) < 10:
  18         response.headers['Auth-Wait'] = '3'
  19     return response
  20 
  21 
  22 @utils.limiter.request_filter
  23 def whitelist_webmail():
  24     try:
  25         return flask.request.headers["Client-Ip"] ==\
  26             socket.gethostbyname("webmail")
  27     except:
  28         return False
  29 
  30 
  31 from mailu.internal.views import *
  32
  ```
  
  Path: `core/admin/mailu/configuration.py`
  Content:
  ```
  1 import os
  2 from mailustart import resolve
  3 
  4 DEFAULT_CONFIG = {
  5     # Specific to the admin UI
  6     'DOCKER_SOCKET': 'unix:///var/run/docker.sock',
  7     'BABEL_DEFAULT_LOCALE': 'en',
  8     'BABEL_DEFAULT_TIMEZONE': 'UTC',
  9     'BOOTSTRAP_SERVE_LOCAL': True,
  10     'RATELIMIT_STORAGE_URL': 'redis://redis/2',
  11     'QUOTA_STORAGE_URL': 'redis://redis/1',
  12     'DEBUG': False,
  13     'DOMAIN_REGISTRATION': False,
  14     'TEMPLATES_AUTO_RELOAD': True,
  15     # Database settings
  16     'DB_FLAVOR': None,
  17     'DB_USER': 'mailu',
  18     'DB_PW': None,
  19     'DB_HOST': 'database',
  20     'DB_NAME': 'mailu',
  21     'SQLITE_DATABASE_FILE':'data/main.db',
  22     'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db',
  23     'SQLALCHEMY_TRACK_MODIFICATIONS': False,
  24     # Statistics management
  25     'INSTANCE_ID_PATH': '/data/instance',
  26     'STATS_ENDPOINT': '0.{}.stats.mailu.io',
  27     # Common configuration variables
  28     'SECRET_KEY': 'changeMe',
  29     'DOMAIN': 'mailu.io',
  30     'HOSTNAMES': 'mail.mailu.io,alternative.mailu.io,yetanother.mailu.io',
  31     'POSTMASTER': 'postmaster',
  32     'TLS_FLAVOR': 'cert',
  33     'AUTH_RATELIMIT': '10/minute;1000/hour',
  34     'DISABLE_STATISTICS': False,
  35     # Mail settings
  36     'DMARC_RUA': None,
  37     'DMARC_RUF': None,
  38     'WELCOME': False,
  39     'WELCOME_SUBJECT': 'Dummy welcome topic',
  40     'WELCOME_BODY': 'Dummy welcome body',
  41     'DKIM_SELECTOR': 'dkim',
  42     'DKIM_PATH': '/dkim/{domain}.{selector}.key',
  43     'DEFAULT_QUOTA': 1000000000,
  44     # Web settings
  45     'SITENAME': 'Mailu',
  46     'WEBSITE': 'https://mailu.io',
  47     'WEB_ADMIN': '/admin',
  48     'WEB_WEBMAIL': '/webmail',
  49     'RECAPTCHA_PUBLIC_KEY': '',
  50     'RECAPTCHA_PRIVATE_KEY': '',
  51     # Advanced settings
  52     'PASSWORD_SCHEME': 'BLF-CRYPT',
  53     # Host settings
  54     'HOST_IMAP': 'imap',
  55     'HOST_POP3': 'imap',
  56     'HOST_SMTP': 'smtp',
  57     'HOST_WEBMAIL': 'webmail',
  58     'HOST_FRONT': 'front',
  59     'HOST_AUTHSMTP': os.environ.get('HOST_SMTP', 'smtp'),
  60     'SUBNET': '192.168.203.0/24',
  61     'POD_ADDRESS_RANGE': None
  62 }
  63 
  64 class ConfigManager(dict):
  65     """ Naive configuration manager that uses environment only
  66     """
  67 
  68     DB_TEMPLATES = {
  69         'sqlite': 'sqlite:////{SQLITE_DATABASE_FILE}',
  70         'postgresql': 'postgresql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}',
  71         'mysql': 'mysql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}'
  72     }
  73 
  74     def __init__(self):
  75         self.config = dict()
  76 
  77     def resolve_host(self):
  78         self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])
  79         self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])
  80         self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])
  81         self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])
  82 
  83     def __coerce_value(self, value):
  84         if isinstance(value, str) and value.lower() in ('true','yes'):
  85             return True
  86         elif isinstance(value, str) and value.lower() in ('false', 'no'):
  87             return False
  88         return value
  89 
  90     def init_app(self, app):
  91         self.config.update(app.config)
  92         # get environment variables
  93         self.config.update({
  94             key: self.__coerce_value(os.environ.get(key, value))
  95             for key, value in DEFAULT_CONFIG.items()
  96         })
  97         self.resolve_host()
  98 
  99         # automatically set the sqlalchemy string
  100         if self.config['DB_FLAVOR']:
  101             template = self.DB_TEMPLATES[self.config['DB_FLAVOR']]
  102             self.config['SQLALCHEMY_DATABASE_URI'] = template.format(**self.config)
  103         # update the app config itself
  104         app.config = self
  105 
  106     def setdefault(self, key, value):
  107         if key not in self.config:
  108             self.config[key] = value
  109         return self.config[key]
  110 
  111     def get(self, *args):
  112         return self.config.get(*args)
  113 
  114     def keys(self):
  115         return self.config.keys()
  116 
  117     def __getitem__(self, key):
  118         return self.config.get(key)
  119 
  120     def __setitem__(self, key, value):
  121         self.config[key] = value
  122 
  123     def __contains__(self, key):
  124         return key in self.config
  125
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py
  --- a/core/admin/mailu/configuration.py
  +++ b/core/admin/mailu/configuration.py
  @@ -46,6 +46,7 @@
       'WEBSITE': 'https://mailu.io',
       'WEB_ADMIN': '/admin',
       'WEB_WEBMAIL': '/webmail',
  +    'WEBMAIL': 'none',
       'RECAPTCHA_PUBLIC_KEY': '',
       'RECAPTCHA_PRIVATE_KEY': '',
       # Advanced settings
  @@ -79,6 +80,8 @@
           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'])
  +        if self.config['WEBMAIL'] != 'none':
  +            self.config['HOST_WEBMAIL'] = resolve(self.config['HOST_WEBMAIL'])
   
       def __coerce_value(self, value):
           if isinstance(value, str) and value.lower() in ('true','yes'):
  diff --git a/core/admin/mailu/internal/__init__.py b/core/admin/mailu/internal/__init__.py
  --- a/core/admin/mailu/internal/__init__.py
  +++ b/core/admin/mailu/internal/__init__.py
  @@ -1,6 +1,7 @@
   from flask_limiter import RateLimitExceeded
   
   from mailu import utils
  +from flask import current_app as app
   
   import socket
   import flask
  @@ -23,7 +24,7 @@
   def whitelist_webmail():
       try:
           return flask.request.headers["Client-Ip"] ==\
  -            socket.gethostbyname("webmail")
  +            app.config["HOST_WEBMAIL"]
       except:
           return False
  
verification_info: {"golden_diff": "diff --git a/core/admin/mailu/configuration.py b/core/admin/mailu/configuration.py\n--- a/core/admin/mailu/configuration.py\n+++ b/core/admin/mailu/configuration.py\n@@ -46,6 +46,7 @@\n     'WEBSITE': 'https://mailu.io',\n     'WEB_ADMIN': '/admin',\n     'WEB_WEBMAIL': '/webmail',\n+    'WEBMAIL': 'none',\n     'RECAPTCHA_PUBLIC_KEY': '',\n     'RECAPTCHA_PRIVATE_KEY': '',\n     # Advanced settings\n@@ -79,6 +80,8 @@\n         self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])\n         self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])\n         self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])\n+        if self.config['WEBMAIL'] != 'none':\n+            self.config['HOST_WEBMAIL'] = resolve(self.config['HOST_WEBMAIL'])\n \n     def __coerce_value(self, value):\n         if isinstance(value, str) and value.lower() in ('true','yes'):\ndiff --git a/core/admin/mailu/internal/__init__.py b/core/admin/mailu/internal/__init__.py\n--- a/core/admin/mailu/internal/__init__.py\n+++ b/core/admin/mailu/internal/__init__.py\n@@ -1,6 +1,7 @@\n from flask_limiter import RateLimitExceeded\n \n from mailu import utils\n+from flask import current_app as app\n \n import socket\n import flask\n@@ -23,7 +24,7 @@\n def whitelist_webmail():\n     try:\n         return flask.request.headers[\"Client-Ip\"] ==\\\n-            socket.gethostbyname(\"webmail\")\n+            app.config[\"HOST_WEBMAIL\"]\n     except:\n         return False\n", "issue": "Admin whitelist_webmail hard coded\nHi,\r\nI'm trying to send transactional email with Mailu SMTP from a backend server and it takes more than 15s.\r\nI tracked down one problem in core/admin/mailu/internal/__init__.py:\r\ndef whitelist_webmail() uses socket.gethostbyname(\"webmail\")\r\n\r\nIn my docker configuration there is no \"webmail\" host so the function socket.gethostbyname return nothing after 5s which slows down a lot the request /internal/auth/email\r\nWhen I set \"webmail\" to a fake ip on the admin server the /internal/auth/email returns immediately.\r\n\r\nMaybe it would be better to define a list of hostnames in the configuration file instead of using a hard coded \"webmail\" value. What do you think?\r\n\r\nThanks Mailu for the great work!\r\nJB\n", "before_files": [{"content": "from flask_limiter import RateLimitExceeded\n\nfrom mailu import utils\n\nimport socket\nimport flask\n\n\ninternal = flask.Blueprint('internal', __name__, template_folder='templates')\n\n\n@internal.app_errorhandler(RateLimitExceeded)\ndef rate_limit_handler(e):\n    response = flask.Response()\n    response.headers['Auth-Status'] = 'Authentication rate limit from one source exceeded'\n    response.headers['Auth-Error-Code'] = '451 4.3.2'\n    if int(flask.request.headers['Auth-Login-Attempt']) < 10:\n        response.headers['Auth-Wait'] = '3'\n    return response\n\n\n@utils.limiter.request_filter\ndef whitelist_webmail():\n    try:\n        return flask.request.headers[\"Client-Ip\"] ==\\\n            socket.gethostbyname(\"webmail\")\n    except:\n        return False\n\n\nfrom mailu.internal.views import *\n", "path": "core/admin/mailu/internal/__init__.py"}, {"content": "import os\nfrom mailustart import resolve\n\nDEFAULT_CONFIG = {\n    # Specific to the admin UI\n    'DOCKER_SOCKET': 'unix:///var/run/docker.sock',\n    'BABEL_DEFAULT_LOCALE': 'en',\n    'BABEL_DEFAULT_TIMEZONE': 'UTC',\n    'BOOTSTRAP_SERVE_LOCAL': True,\n    'RATELIMIT_STORAGE_URL': 'redis://redis/2',\n    'QUOTA_STORAGE_URL': 'redis://redis/1',\n    'DEBUG': False,\n    'DOMAIN_REGISTRATION': False,\n    'TEMPLATES_AUTO_RELOAD': True,\n    # Database settings\n    'DB_FLAVOR': None,\n    'DB_USER': 'mailu',\n    'DB_PW': None,\n    'DB_HOST': 'database',\n    'DB_NAME': 'mailu',\n    'SQLITE_DATABASE_FILE':'data/main.db',\n    'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db',\n    'SQLALCHEMY_TRACK_MODIFICATIONS': False,\n    # Statistics management\n    'INSTANCE_ID_PATH': '/data/instance',\n    'STATS_ENDPOINT': '0.{}.stats.mailu.io',\n    # Common configuration variables\n    'SECRET_KEY': 'changeMe',\n    'DOMAIN': 'mailu.io',\n    'HOSTNAMES': 'mail.mailu.io,alternative.mailu.io,yetanother.mailu.io',\n    'POSTMASTER': 'postmaster',\n    'TLS_FLAVOR': 'cert',\n    'AUTH_RATELIMIT': '10/minute;1000/hour',\n    'DISABLE_STATISTICS': False,\n    # Mail settings\n    'DMARC_RUA': None,\n    'DMARC_RUF': None,\n    'WELCOME': False,\n    'WELCOME_SUBJECT': 'Dummy welcome topic',\n    'WELCOME_BODY': 'Dummy welcome body',\n    'DKIM_SELECTOR': 'dkim',\n    'DKIM_PATH': '/dkim/{domain}.{selector}.key',\n    'DEFAULT_QUOTA': 1000000000,\n    # Web settings\n    'SITENAME': 'Mailu',\n    'WEBSITE': 'https://mailu.io',\n    'WEB_ADMIN': '/admin',\n    'WEB_WEBMAIL': '/webmail',\n    'RECAPTCHA_PUBLIC_KEY': '',\n    'RECAPTCHA_PRIVATE_KEY': '',\n    # Advanced settings\n    'PASSWORD_SCHEME': 'BLF-CRYPT',\n    # Host settings\n    'HOST_IMAP': 'imap',\n    'HOST_POP3': 'imap',\n    'HOST_SMTP': 'smtp',\n    'HOST_WEBMAIL': 'webmail',\n    'HOST_FRONT': 'front',\n    'HOST_AUTHSMTP': os.environ.get('HOST_SMTP', 'smtp'),\n    'SUBNET': '192.168.203.0/24',\n    'POD_ADDRESS_RANGE': None\n}\n\nclass ConfigManager(dict):\n    \"\"\" Naive configuration manager that uses environment only\n    \"\"\"\n\n    DB_TEMPLATES = {\n        'sqlite': 'sqlite:////{SQLITE_DATABASE_FILE}',\n        'postgresql': 'postgresql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}',\n        'mysql': 'mysql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}'\n    }\n\n    def __init__(self):\n        self.config = dict()\n\n    def resolve_host(self):\n        self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])\n        self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])\n        self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])\n        self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])\n\n    def __coerce_value(self, value):\n        if isinstance(value, str) and value.lower() in ('true','yes'):\n            return True\n        elif isinstance(value, str) and value.lower() in ('false', 'no'):\n            return False\n        return value\n\n    def init_app(self, app):\n        self.config.update(app.config)\n        # get environment variables\n        self.config.update({\n            key: self.__coerce_value(os.environ.get(key, value))\n            for key, value in DEFAULT_CONFIG.items()\n        })\n        self.resolve_host()\n\n        # automatically set the sqlalchemy string\n        if self.config['DB_FLAVOR']:\n            template = self.DB_TEMPLATES[self.config['DB_FLAVOR']]\n            self.config['SQLALCHEMY_DATABASE_URI'] = template.format(**self.config)\n        # update the app config itself\n        app.config = self\n\n    def setdefault(self, key, value):\n        if key not in self.config:\n            self.config[key] = value\n        return self.config[key]\n\n    def get(self, *args):\n        return self.config.get(*args)\n\n    def keys(self):\n        return self.config.keys()\n\n    def __getitem__(self, key):\n        return self.config.get(key)\n\n    def __setitem__(self, key, value):\n        self.config[key] = value\n\n    def __contains__(self, key):\n        return key in self.config\n", "path": "core/admin/mailu/configuration.py"}], "after_files": [{"content": "from flask_limiter import RateLimitExceeded\n\nfrom mailu import utils\nfrom flask import current_app as app\n\nimport socket\nimport flask\n\n\ninternal = flask.Blueprint('internal', __name__, template_folder='templates')\n\n\n@internal.app_errorhandler(RateLimitExceeded)\ndef rate_limit_handler(e):\n    response = flask.Response()\n    response.headers['Auth-Status'] = 'Authentication rate limit from one source exceeded'\n    response.headers['Auth-Error-Code'] = '451 4.3.2'\n    if int(flask.request.headers['Auth-Login-Attempt']) < 10:\n        response.headers['Auth-Wait'] = '3'\n    return response\n\n\n@utils.limiter.request_filter\ndef whitelist_webmail():\n    try:\n        return flask.request.headers[\"Client-Ip\"] ==\\\n            app.config[\"HOST_WEBMAIL\"]\n    except:\n        return False\n\n\nfrom mailu.internal.views import *\n", "path": "core/admin/mailu/internal/__init__.py"}, {"content": "import os\nfrom mailustart import resolve\n\nDEFAULT_CONFIG = {\n    # Specific to the admin UI\n    'DOCKER_SOCKET': 'unix:///var/run/docker.sock',\n    'BABEL_DEFAULT_LOCALE': 'en',\n    'BABEL_DEFAULT_TIMEZONE': 'UTC',\n    'BOOTSTRAP_SERVE_LOCAL': True,\n    'RATELIMIT_STORAGE_URL': 'redis://redis/2',\n    'QUOTA_STORAGE_URL': 'redis://redis/1',\n    'DEBUG': False,\n    'DOMAIN_REGISTRATION': False,\n    'TEMPLATES_AUTO_RELOAD': True,\n    # Database settings\n    'DB_FLAVOR': None,\n    'DB_USER': 'mailu',\n    'DB_PW': None,\n    'DB_HOST': 'database',\n    'DB_NAME': 'mailu',\n    'SQLITE_DATABASE_FILE':'data/main.db',\n    'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db',\n    'SQLALCHEMY_TRACK_MODIFICATIONS': False,\n    # Statistics management\n    'INSTANCE_ID_PATH': '/data/instance',\n    'STATS_ENDPOINT': '0.{}.stats.mailu.io',\n    # Common configuration variables\n    'SECRET_KEY': 'changeMe',\n    'DOMAIN': 'mailu.io',\n    'HOSTNAMES': 'mail.mailu.io,alternative.mailu.io,yetanother.mailu.io',\n    'POSTMASTER': 'postmaster',\n    'TLS_FLAVOR': 'cert',\n    'AUTH_RATELIMIT': '10/minute;1000/hour',\n    'DISABLE_STATISTICS': False,\n    # Mail settings\n    'DMARC_RUA': None,\n    'DMARC_RUF': None,\n    'WELCOME': False,\n    'WELCOME_SUBJECT': 'Dummy welcome topic',\n    'WELCOME_BODY': 'Dummy welcome body',\n    'DKIM_SELECTOR': 'dkim',\n    'DKIM_PATH': '/dkim/{domain}.{selector}.key',\n    'DEFAULT_QUOTA': 1000000000,\n    # Web settings\n    'SITENAME': 'Mailu',\n    'WEBSITE': 'https://mailu.io',\n    'WEB_ADMIN': '/admin',\n    'WEB_WEBMAIL': '/webmail',\n    'WEBMAIL': 'none',\n    'RECAPTCHA_PUBLIC_KEY': '',\n    'RECAPTCHA_PRIVATE_KEY': '',\n    # Advanced settings\n    'PASSWORD_SCHEME': 'BLF-CRYPT',\n    # Host settings\n    'HOST_IMAP': 'imap',\n    'HOST_POP3': 'imap',\n    'HOST_SMTP': 'smtp',\n    'HOST_WEBMAIL': 'webmail',\n    'HOST_FRONT': 'front',\n    'HOST_AUTHSMTP': os.environ.get('HOST_SMTP', 'smtp'),\n    'SUBNET': '192.168.203.0/24',\n    'POD_ADDRESS_RANGE': None\n}\n\nclass ConfigManager(dict):\n    \"\"\" Naive configuration manager that uses environment only\n    \"\"\"\n\n    DB_TEMPLATES = {\n        'sqlite': 'sqlite:////{SQLITE_DATABASE_FILE}',\n        'postgresql': 'postgresql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}',\n        'mysql': 'mysql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}'\n    }\n\n    def __init__(self):\n        self.config = dict()\n\n    def resolve_host(self):\n        self.config['HOST_IMAP'] = resolve(self.config['HOST_IMAP'])\n        self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])\n        self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])\n        self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])\n        if self.config['WEBMAIL'] != 'none':\n            self.config['HOST_WEBMAIL'] = resolve(self.config['HOST_WEBMAIL'])\n\n    def __coerce_value(self, value):\n        if isinstance(value, str) and value.lower() in ('true','yes'):\n            return True\n        elif isinstance(value, str) and value.lower() in ('false', 'no'):\n            return False\n        return value\n\n    def init_app(self, app):\n        self.config.update(app.config)\n        # get environment variables\n        self.config.update({\n            key: self.__coerce_value(os.environ.get(key, value))\n            for key, value in DEFAULT_CONFIG.items()\n        })\n        self.resolve_host()\n\n        # automatically set the sqlalchemy string\n        if self.config['DB_FLAVOR']:\n            template = self.DB_TEMPLATES[self.config['DB_FLAVOR']]\n            self.config['SQLALCHEMY_DATABASE_URI'] = template.format(**self.config)\n        # update the app config itself\n        app.config = self\n\n    def setdefault(self, key, value):\n        if key not in self.config:\n            self.config[key] = value\n        return self.config[key]\n\n    def get(self, *args):\n        return self.config.get(*args)\n\n    def keys(self):\n        return self.config.keys()\n\n    def __getitem__(self, key):\n        return self.config.get(key)\n\n    def __setitem__(self, key, value):\n        self.config[key] = value\n\n    def __contains__(self, key):\n        return key in self.config\n", "path": "core/admin/mailu/configuration.py"}]}