We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Rate limiting changes for 1.8
Copied from #1582. For 1.8 we will for now increase rate limiting value and disable rate limiting for the  subnet. 

- Rate limiting
  - Document rate limiting
  - Currently the subnet is included in the rate limiting. This means that a user who repeatly fails to login the webmail, blocks the webmail for ALL users.

- For 1.8 and master
  - in mailu.env set the rate limit to a high value.
  - in mailu.env disable the rate limiter for the subnet.
  - And document this of course and change this in the documentation
  - Set status blocked on lubs pull request and request to further discuss this for mailu 1.9.
  -  Make authentication fast #1745 is a draft pr from nextgens which contains a solution for this problem.
  -  We need a new issue and PR for making these changes.

--- 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/configuration.py`
Content:
```
1 import os
2 
3 from datetime import timedelta
4 from socrate import system
5 
6 DEFAULT_CONFIG = {
7     # Specific to the admin UI
8     'DOCKER_SOCKET': 'unix:///var/run/docker.sock',
9     'BABEL_DEFAULT_LOCALE': 'en',
10     'BABEL_DEFAULT_TIMEZONE': 'UTC',
11     'BOOTSTRAP_SERVE_LOCAL': True,
12     'RATELIMIT_STORAGE_URL': '',
13     'QUOTA_STORAGE_URL': '',
14     'DEBUG': False,
15     'DOMAIN_REGISTRATION': False,
16     'TEMPLATES_AUTO_RELOAD': True,
17     'MEMORY_SESSIONS': False,
18     # Database settings
19     'DB_FLAVOR': None,
20     'DB_USER': 'mailu',
21     'DB_PW': None,
22     'DB_HOST': 'database',
23     'DB_NAME': 'mailu',
24     'SQLITE_DATABASE_FILE':'data/main.db',
25     'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db',
26     'SQLALCHEMY_TRACK_MODIFICATIONS': False,
27     # Statistics management
28     'INSTANCE_ID_PATH': '/data/instance',
29     'STATS_ENDPOINT': '18.{}.stats.mailu.io',
30     # Common configuration variables
31     'SECRET_KEY': 'changeMe',
32     'DOMAIN': 'mailu.io',
33     'HOSTNAMES': 'mail.mailu.io,alternative.mailu.io,yetanother.mailu.io',
34     'POSTMASTER': 'postmaster',
35     'TLS_FLAVOR': 'cert',
36     'INBOUND_TLS_ENFORCE': False,
37     'AUTH_RATELIMIT': '10/minute;1000/hour',
38     'AUTH_RATELIMIT_SUBNET': True,
39     'DISABLE_STATISTICS': False,
40     # Mail settings
41     'DMARC_RUA': None,
42     'DMARC_RUF': None,
43     'WELCOME': False,
44     'WELCOME_SUBJECT': 'Dummy welcome topic',
45     'WELCOME_BODY': 'Dummy welcome body',
46     'DKIM_SELECTOR': 'dkim',
47     'DKIM_PATH': '/dkim/{domain}.{selector}.key',
48     'DEFAULT_QUOTA': 1000000000,
49     # Web settings
50     'SITENAME': 'Mailu',
51     'WEBSITE': 'https://mailu.io',
52     'WEB_ADMIN': '/admin',
53     'WEB_WEBMAIL': '/webmail',
54     'WEBMAIL': 'none',
55     'RECAPTCHA_PUBLIC_KEY': '',
56     'RECAPTCHA_PRIVATE_KEY': '',
57     # Advanced settings
58     'LOG_LEVEL': 'WARNING',
59     'SESSION_KEY_BITS': 128,
60     'SESSION_LIFETIME': 24,
61     'SESSION_COOKIE_SECURE': True,
62     'CREDENTIAL_ROUNDS': 12,
63     # Host settings
64     'HOST_IMAP': 'imap',
65     'HOST_LMTP': 'imap:2525',
66     'HOST_POP3': 'imap',
67     'HOST_SMTP': 'smtp',
68     'HOST_AUTHSMTP': 'smtp',
69     'HOST_ADMIN': 'admin',
70     'HOST_WEBMAIL': 'webmail',
71     'HOST_WEBDAV': 'webdav:5232',
72     'HOST_REDIS': 'redis',
73     'HOST_FRONT': 'front',
74     'SUBNET': '192.168.203.0/24',
75     'SUBNET6': None,
76     'POD_ADDRESS_RANGE': None
77 }
78 
79 class ConfigManager(dict):
80     """ Naive configuration manager that uses environment only
81     """
82 
83     DB_TEMPLATES = {
84         'sqlite': 'sqlite:////{SQLITE_DATABASE_FILE}',
85         'postgresql': 'postgresql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}',
86         'mysql': 'mysql://{DB_USER}:{DB_PW}@{DB_HOST}/{DB_NAME}'
87     }
88 
89     def __init__(self):
90         self.config = dict()
91 
92     def get_host_address(self, name):
93         # if MYSERVICE_ADDRESS is defined, use this
94         if '{}_ADDRESS'.format(name) in os.environ:
95             return os.environ.get('{}_ADDRESS'.format(name))
96         # otherwise use the host name and resolve it
97         return system.resolve_address(self.config['HOST_{}'.format(name)])
98 
99     def resolve_hosts(self):
100         self.config["IMAP_ADDRESS"] = self.get_host_address("IMAP")
101         self.config["POP3_ADDRESS"] = self.get_host_address("POP3")
102         self.config["AUTHSMTP_ADDRESS"] = self.get_host_address("AUTHSMTP")
103         self.config["SMTP_ADDRESS"] = self.get_host_address("SMTP")
104         self.config["REDIS_ADDRESS"] = self.get_host_address("REDIS")
105         if self.config["WEBMAIL"] != "none":
106             self.config["WEBMAIL_ADDRESS"] = self.get_host_address("WEBMAIL")
107 
108     def __get_env(self, key, value):
109         key_file = key + "_FILE"
110         if key_file in os.environ:
111             with open(os.environ.get(key_file)) as file:
112                 value_from_file = file.read()
113             return value_from_file.strip()
114         else:
115             return os.environ.get(key, value)
116 
117     def __coerce_value(self, value):
118         if isinstance(value, str) and value.lower() in ('true','yes'):
119             return True
120         elif isinstance(value, str) and value.lower() in ('false', 'no'):
121             return False
122         return value
123 
124     def init_app(self, app):
125         self.config.update(app.config)
126         # get environment variables
127         self.config.update({
128             key: self.__coerce_value(self.__get_env(key, value))
129             for key, value in DEFAULT_CONFIG.items()
130         })
131         self.resolve_hosts()
132 
133         # automatically set the sqlalchemy string
134         if self.config['DB_FLAVOR']:
135             template = self.DB_TEMPLATES[self.config['DB_FLAVOR']]
136             self.config['SQLALCHEMY_DATABASE_URI'] = template.format(**self.config)
137 
138         self.config['RATELIMIT_STORAGE_URL'] = 'redis://{0}/2'.format(self.config['REDIS_ADDRESS'])
139         self.config['QUOTA_STORAGE_URL'] = 'redis://{0}/1'.format(self.config['REDIS_ADDRESS'])
140         self.config['SESSION_STORAGE_URL'] = 'redis://{0}/3'.format(self.config['REDIS_ADDRESS'])
141         self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
142         self.config['SESSION_COOKIE_HTTPONLY'] = True
143         self.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=int(self.config['SESSION_LIFETIME']))
144         # update the app config itself
145         app.config = self
146 
147     def setdefault(self, key, value):
148         if key not in self.config:
149             self.config[key] = value
150         return self.config[key]
151 
152     def get(self, *args):
153         return self.config.get(*args)
154 
155     def keys(self):
156         return self.config.keys()
157 
158     def __getitem__(self, key):
159         return self.config.get(key)
160 
161     def __setitem__(self, key, value):
162         self.config[key] = value
163 
164     def __contains__(self, key):
165         return key in self.config
166
```
--- 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()

```

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
@@ -34,8 +34,8 @@
     'POSTMASTER': 'postmaster',
     'TLS_FLAVOR': 'cert',
     'INBOUND_TLS_ENFORCE': False,
-    'AUTH_RATELIMIT': '10/minute;1000/hour',
-    'AUTH_RATELIMIT_SUBNET': True,
+    'AUTH_RATELIMIT': '1000/minute;10000/hour',
+    'AUTH_RATELIMIT_SUBNET': False,
     'DISABLE_STATISTICS': False,
     # Mail settings
     'DMARC_RUA': None,

{"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@@ -34,8 +34,8 @@\n     'POSTMASTER': 'postmaster',\n     'TLS_FLAVOR': 'cert',\n     'INBOUND_TLS_ENFORCE': False,\n-    'AUTH_RATELIMIT': '10/minute;1000/hour',\n-    'AUTH_RATELIMIT_SUBNET': True,\n+    'AUTH_RATELIMIT': '1000/minute;10000/hour',\n+    'AUTH_RATELIMIT_SUBNET': False,\n     'DISABLE_STATISTICS': False,\n     # Mail settings\n     'DMARC_RUA': None,\n", "issue": "Rate limiting changes for 1.8\nCopied from #1582. For 1.8 we will for now increase rate limiting value and disable rate limiting for the  subnet. \r\n\r\n- Rate limiting\r\n  - Document rate limiting\r\n  - Currently the subnet is included in the rate limiting. This means that a user who repeatly fails to login the webmail, blocks the webmail for ALL users.\r\n\r\n- For 1.8 and master\r\n  - in mailu.env set the rate limit to a high value.\r\n  - in mailu.env disable the rate limiter for the subnet.\r\n  - And document this of course and change this in the documentation\r\n  - Set status blocked on lubs pull request and request to further discuss this for mailu 1.9.\r\n  -  Make authentication fast #1745 is a draft pr from nextgens which contains a solution for this problem.\r\n  -  We need a new issue and PR for making these changes.\n", "before_files": [{"content": "import os\n\nfrom datetime import timedelta\nfrom socrate import system\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': '',\n    'QUOTA_STORAGE_URL': '',\n    'DEBUG': False,\n    'DOMAIN_REGISTRATION': False,\n    'TEMPLATES_AUTO_RELOAD': True,\n    'MEMORY_SESSIONS': False,\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': '18.{}.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    'INBOUND_TLS_ENFORCE': False,\n    'AUTH_RATELIMIT': '10/minute;1000/hour',\n    'AUTH_RATELIMIT_SUBNET': True,\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    'LOG_LEVEL': 'WARNING',\n    'SESSION_KEY_BITS': 128,\n    'SESSION_LIFETIME': 24,\n    'SESSION_COOKIE_SECURE': True,\n    'CREDENTIAL_ROUNDS': 12,\n    # Host settings\n    'HOST_IMAP': 'imap',\n    'HOST_LMTP': 'imap:2525',\n    'HOST_POP3': 'imap',\n    'HOST_SMTP': 'smtp',\n    'HOST_AUTHSMTP': 'smtp',\n    'HOST_ADMIN': 'admin',\n    'HOST_WEBMAIL': 'webmail',\n    'HOST_WEBDAV': 'webdav:5232',\n    'HOST_REDIS': 'redis',\n    'HOST_FRONT': 'front',\n    'SUBNET': '192.168.203.0/24',\n    'SUBNET6': None,\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 get_host_address(self, name):\n        # if MYSERVICE_ADDRESS is defined, use this\n        if '{}_ADDRESS'.format(name) in os.environ:\n            return os.environ.get('{}_ADDRESS'.format(name))\n        # otherwise use the host name and resolve it\n        return system.resolve_address(self.config['HOST_{}'.format(name)])\n\n    def resolve_hosts(self):\n        self.config[\"IMAP_ADDRESS\"] = self.get_host_address(\"IMAP\")\n        self.config[\"POP3_ADDRESS\"] = self.get_host_address(\"POP3\")\n        self.config[\"AUTHSMTP_ADDRESS\"] = self.get_host_address(\"AUTHSMTP\")\n        self.config[\"SMTP_ADDRESS\"] = self.get_host_address(\"SMTP\")\n        self.config[\"REDIS_ADDRESS\"] = self.get_host_address(\"REDIS\")\n        if self.config[\"WEBMAIL\"] != \"none\":\n            self.config[\"WEBMAIL_ADDRESS\"] = self.get_host_address(\"WEBMAIL\")\n\n    def __get_env(self, key, value):\n        key_file = key + \"_FILE\"\n        if key_file in os.environ:\n            with open(os.environ.get(key_file)) as file:\n                value_from_file = file.read()\n            return value_from_file.strip()\n        else:\n            return os.environ.get(key, value)\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(self.__get_env(key, value))\n            for key, value in DEFAULT_CONFIG.items()\n        })\n        self.resolve_hosts()\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\n        self.config['RATELIMIT_STORAGE_URL'] = 'redis://{0}/2'.format(self.config['REDIS_ADDRESS'])\n        self.config['QUOTA_STORAGE_URL'] = 'redis://{0}/1'.format(self.config['REDIS_ADDRESS'])\n        self.config['SESSION_STORAGE_URL'] = 'redis://{0}/3'.format(self.config['REDIS_ADDRESS'])\n        self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'\n        self.config['SESSION_COOKIE_HTTPONLY'] = True\n        self.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=int(self.config['SESSION_LIFETIME']))\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": "import os\n\nfrom datetime import timedelta\nfrom socrate import system\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': '',\n    'QUOTA_STORAGE_URL': '',\n    'DEBUG': False,\n    'DOMAIN_REGISTRATION': False,\n    'TEMPLATES_AUTO_RELOAD': True,\n    'MEMORY_SESSIONS': False,\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': '18.{}.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    'INBOUND_TLS_ENFORCE': False,\n    'AUTH_RATELIMIT': '1000/minute;10000/hour',\n    'AUTH_RATELIMIT_SUBNET': False,\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    'LOG_LEVEL': 'WARNING',\n    'SESSION_KEY_BITS': 128,\n    'SESSION_LIFETIME': 24,\n    'SESSION_COOKIE_SECURE': True,\n    'CREDENTIAL_ROUNDS': 12,\n    # Host settings\n    'HOST_IMAP': 'imap',\n    'HOST_LMTP': 'imap:2525',\n    'HOST_POP3': 'imap',\n    'HOST_SMTP': 'smtp',\n    'HOST_AUTHSMTP': 'smtp',\n    'HOST_ADMIN': 'admin',\n    'HOST_WEBMAIL': 'webmail',\n    'HOST_WEBDAV': 'webdav:5232',\n    'HOST_REDIS': 'redis',\n    'HOST_FRONT': 'front',\n    'SUBNET': '192.168.203.0/24',\n    'SUBNET6': None,\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 get_host_address(self, name):\n        # if MYSERVICE_ADDRESS is defined, use this\n        if '{}_ADDRESS'.format(name) in os.environ:\n            return os.environ.get('{}_ADDRESS'.format(name))\n        # otherwise use the host name and resolve it\n        return system.resolve_address(self.config['HOST_{}'.format(name)])\n\n    def resolve_hosts(self):\n        self.config[\"IMAP_ADDRESS\"] = self.get_host_address(\"IMAP\")\n        self.config[\"POP3_ADDRESS\"] = self.get_host_address(\"POP3\")\n        self.config[\"AUTHSMTP_ADDRESS\"] = self.get_host_address(\"AUTHSMTP\")\n        self.config[\"SMTP_ADDRESS\"] = self.get_host_address(\"SMTP\")\n        self.config[\"REDIS_ADDRESS\"] = self.get_host_address(\"REDIS\")\n        if self.config[\"WEBMAIL\"] != \"none\":\n            self.config[\"WEBMAIL_ADDRESS\"] = self.get_host_address(\"WEBMAIL\")\n\n    def __get_env(self, key, value):\n        key_file = key + \"_FILE\"\n        if key_file in os.environ:\n            with open(os.environ.get(key_file)) as file:\n                value_from_file = file.read()\n            return value_from_file.strip()\n        else:\n            return os.environ.get(key, value)\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(self.__get_env(key, value))\n            for key, value in DEFAULT_CONFIG.items()\n        })\n        self.resolve_hosts()\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\n        self.config['RATELIMIT_STORAGE_URL'] = 'redis://{0}/2'.format(self.config['REDIS_ADDRESS'])\n        self.config['QUOTA_STORAGE_URL'] = 'redis://{0}/1'.format(self.config['REDIS_ADDRESS'])\n        self.config['SESSION_STORAGE_URL'] = 'redis://{0}/3'.format(self.config['REDIS_ADDRESS'])\n        self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'\n        self.config['SESSION_COOKIE_HTTPONLY'] = True\n        self.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=int(self.config['SESSION_LIFETIME']))\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"}]}