We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
docker: Enable WEBLATE_GITLAB_CREDENTIALS environment variable
### Describe the problem

Right now it seems I can use gitlab_username and gitlab_token variables. But when I try to use gitlab_credentials:

>       WEBLATE_GITLAB_CREDENTIALS: "git.duniter.org": {username: weblate,token: XXXXXXXXXXXXXXX}

I get this error:

> ERROR: yaml.scanner.ScannerError: mapping values are not allowed here
>   in "./docker-compose.override.yml", line 17, column 52


### Describe the solution you'd like

Add weblate_gitlab_credentials support

### Describe alternatives you've considered

_No response_

### Screenshots

_No response_

### Additional context

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `weblate/utils/environment.py`
Content:
```
1 # Copyright © Michal Čihař <michal@weblate.org>
2 #
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 
5 from __future__ import annotations
6 
7 import os
8 
9 
10 def get_env_str(
11     name: str,
12     default: str | None = None,
13     required: bool = False,
14     fallback_name: str | None = None,
15 ) -> str:
16     file_env = f"{name}_FILE"
17     if filename := os.environ.get(file_env):
18         try:
19             with open(filename) as handle:
20                 result = handle.read()
21         except OSError as error:
22             raise ValueError(
23                 f"Failed to open {filename} as specified by {file_env}: {error}"
24             ) from error
25     else:
26         if fallback_name and name not in os.environ:
27             name = fallback_name
28         result = os.environ.get(name, default)
29     if required and not result:
30         raise ValueError(f"{name} has to be configured!")
31     return result
32 
33 
34 def get_env_list(name: str, default: list[str] | None = None) -> list[str]:
35     """Helper to get list from environment."""
36     if name not in os.environ:
37         return default or []
38     return os.environ[name].split(",")
39 
40 
41 def get_env_map(name: str, default: dict[str, str] | None = None) -> dict[str, str]:
42     """
43     Helper to get mapping from environment.
44 
45     parses 'full_name:name,email:mail' into {'email': 'mail', 'full_name': 'name'}
46     """
47     if os.environ.get(name):
48         return dict(e.split(":") for e in os.environ[name].split(","))
49     return default or {}
50 
51 
52 def get_env_int(name: str, default: int = 0) -> int:
53     """Helper to get integer value from environment."""
54     if name not in os.environ:
55         return default
56     try:
57         return int(os.environ[name])
58     except ValueError as error:
59         raise ValueError(f"{name} is not an integer: {error}") from error
60 
61 
62 def get_env_float(name: str, default: float = 0.0) -> float:
63     """Helper to get float value from environment."""
64     if name not in os.environ:
65         return default
66     try:
67         return float(os.environ[name])
68     except ValueError as error:
69         raise ValueError(f"{name} is not an float: {error}") from error
70 
71 
72 def get_env_bool(name: str, default: bool = False) -> bool:
73     """Helper to get boolean value from environment."""
74     if name not in os.environ:
75         return default
76     true_values = {"true", "yes", "1"}
77     return os.environ[name].lower() in true_values
78 
79 
80 def modify_env_list(current: list[str], name: str) -> list[str]:
81     """Helper to modify list (for example checks)."""
82     for item in reversed(get_env_list(f"WEBLATE_ADD_{name}")):
83         current.insert(0, item)
84     for item in get_env_list(f"WEBLATE_REMOVE_{name}"):
85         current.remove(item)
86     return current
87 
88 
89 def get_env_credentials(
90     name: str,
91 ) -> dict[str, dict[str, str]]:
92     """Parses VCS integration credentials."""
93     username = os.environ.get(f"WEBLATE_{name}_USERNAME")
94     token = os.environ.get(f"WEBLATE_{name}_TOKEN")
95     host = os.environ.get(f"WEBLATE_{name}_HOST")
96 
97     if not host and (username or token):
98         raise ValueError(
99             f"Incomplete {name}_CREDENTIALS configuration: missing WEBLATE_{name}_HOST"
100         )
101     return {host: {"username": username, "token": token}}
102 
103 
104 def get_env_ratelimit(name: str, default: str) -> str:
105     value = os.environ.get(name, default)
106 
107     # Taken from rest_framework.throttling.SimpleRateThrottle.parse_rate
108     # it can not be imported here as that breaks config loading for
109     # rest_framework
110 
111     try:
112         num, period = value.split("/")
113     except ValueError as error:
114         raise ValueError(f"Could not parse {name}: {error}") from error
115     if not num.isdigit():
116         raise ValueError(f"Could not parse {name}: rate is not numeric: {num}")
117     if period[0] not in ("s", "m", "h", "d"):
118         raise ValueError(f"Could not parse {name}: unknown period: {period}")
119 
120     return value
121
```
--- 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/weblate/utils/environment.py b/weblate/utils/environment.py
--- a/weblate/utils/environment.py
+++ b/weblate/utils/environment.py
@@ -4,6 +4,7 @@
 
 from __future__ import annotations
 
+import ast
 import os
 
 
@@ -90,6 +91,8 @@
     name: str,
 ) -> dict[str, dict[str, str]]:
     """Parses VCS integration credentials."""
+    if credentials := get_env_str(f"WEBLATE_{name}_CREDENTIALS"):
+        return ast.literal_eval(credentials)
     username = os.environ.get(f"WEBLATE_{name}_USERNAME")
     token = os.environ.get(f"WEBLATE_{name}_TOKEN")
     host = os.environ.get(f"WEBLATE_{name}_HOST")

{"golden_diff": "diff --git a/weblate/utils/environment.py b/weblate/utils/environment.py\n--- a/weblate/utils/environment.py\n+++ b/weblate/utils/environment.py\n@@ -4,6 +4,7 @@\n \n from __future__ import annotations\n \n+import ast\n import os\n \n \n@@ -90,6 +91,8 @@\n     name: str,\n ) -> dict[str, dict[str, str]]:\n     \"\"\"Parses VCS integration credentials.\"\"\"\n+    if credentials := get_env_str(f\"WEBLATE_{name}_CREDENTIALS\"):\n+        return ast.literal_eval(credentials)\n     username = os.environ.get(f\"WEBLATE_{name}_USERNAME\")\n     token = os.environ.get(f\"WEBLATE_{name}_TOKEN\")\n     host = os.environ.get(f\"WEBLATE_{name}_HOST\")\n", "issue": "docker: Enable WEBLATE_GITLAB_CREDENTIALS environment variable\n### Describe the problem\n\nRight now it seems I can use gitlab_username and gitlab_token variables. But when I try to use gitlab_credentials:\r\n\r\n>       WEBLATE_GITLAB_CREDENTIALS: \"git.duniter.org\": {username: weblate,token: XXXXXXXXXXXXXXX}\r\n\r\nI get this error:\r\n\r\n> ERROR: yaml.scanner.ScannerError: mapping values are not allowed here\r\n>   in \"./docker-compose.override.yml\", line 17, column 52\r\n\n\n### Describe the solution you'd like\n\nAdd weblate_gitlab_credentials support\n\n### Describe alternatives you've considered\n\n_No response_\n\n### Screenshots\n\n_No response_\n\n### Additional context\n\n_No response_\n", "before_files": [{"content": "# Copyright \u00a9 Michal \u010ciha\u0159 <michal@weblate.org>\n#\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nfrom __future__ import annotations\n\nimport os\n\n\ndef get_env_str(\n    name: str,\n    default: str | None = None,\n    required: bool = False,\n    fallback_name: str | None = None,\n) -> str:\n    file_env = f\"{name}_FILE\"\n    if filename := os.environ.get(file_env):\n        try:\n            with open(filename) as handle:\n                result = handle.read()\n        except OSError as error:\n            raise ValueError(\n                f\"Failed to open {filename} as specified by {file_env}: {error}\"\n            ) from error\n    else:\n        if fallback_name and name not in os.environ:\n            name = fallback_name\n        result = os.environ.get(name, default)\n    if required and not result:\n        raise ValueError(f\"{name} has to be configured!\")\n    return result\n\n\ndef get_env_list(name: str, default: list[str] | None = None) -> list[str]:\n    \"\"\"Helper to get list from environment.\"\"\"\n    if name not in os.environ:\n        return default or []\n    return os.environ[name].split(\",\")\n\n\ndef get_env_map(name: str, default: dict[str, str] | None = None) -> dict[str, str]:\n    \"\"\"\n    Helper to get mapping from environment.\n\n    parses 'full_name:name,email:mail' into {'email': 'mail', 'full_name': 'name'}\n    \"\"\"\n    if os.environ.get(name):\n        return dict(e.split(\":\") for e in os.environ[name].split(\",\"))\n    return default or {}\n\n\ndef get_env_int(name: str, default: int = 0) -> int:\n    \"\"\"Helper to get integer value from environment.\"\"\"\n    if name not in os.environ:\n        return default\n    try:\n        return int(os.environ[name])\n    except ValueError as error:\n        raise ValueError(f\"{name} is not an integer: {error}\") from error\n\n\ndef get_env_float(name: str, default: float = 0.0) -> float:\n    \"\"\"Helper to get float value from environment.\"\"\"\n    if name not in os.environ:\n        return default\n    try:\n        return float(os.environ[name])\n    except ValueError as error:\n        raise ValueError(f\"{name} is not an float: {error}\") from error\n\n\ndef get_env_bool(name: str, default: bool = False) -> bool:\n    \"\"\"Helper to get boolean value from environment.\"\"\"\n    if name not in os.environ:\n        return default\n    true_values = {\"true\", \"yes\", \"1\"}\n    return os.environ[name].lower() in true_values\n\n\ndef modify_env_list(current: list[str], name: str) -> list[str]:\n    \"\"\"Helper to modify list (for example checks).\"\"\"\n    for item in reversed(get_env_list(f\"WEBLATE_ADD_{name}\")):\n        current.insert(0, item)\n    for item in get_env_list(f\"WEBLATE_REMOVE_{name}\"):\n        current.remove(item)\n    return current\n\n\ndef get_env_credentials(\n    name: str,\n) -> dict[str, dict[str, str]]:\n    \"\"\"Parses VCS integration credentials.\"\"\"\n    username = os.environ.get(f\"WEBLATE_{name}_USERNAME\")\n    token = os.environ.get(f\"WEBLATE_{name}_TOKEN\")\n    host = os.environ.get(f\"WEBLATE_{name}_HOST\")\n\n    if not host and (username or token):\n        raise ValueError(\n            f\"Incomplete {name}_CREDENTIALS configuration: missing WEBLATE_{name}_HOST\"\n        )\n    return {host: {\"username\": username, \"token\": token}}\n\n\ndef get_env_ratelimit(name: str, default: str) -> str:\n    value = os.environ.get(name, default)\n\n    # Taken from rest_framework.throttling.SimpleRateThrottle.parse_rate\n    # it can not be imported here as that breaks config loading for\n    # rest_framework\n\n    try:\n        num, period = value.split(\"/\")\n    except ValueError as error:\n        raise ValueError(f\"Could not parse {name}: {error}\") from error\n    if not num.isdigit():\n        raise ValueError(f\"Could not parse {name}: rate is not numeric: {num}\")\n    if period[0] not in (\"s\", \"m\", \"h\", \"d\"):\n        raise ValueError(f\"Could not parse {name}: unknown period: {period}\")\n\n    return value\n", "path": "weblate/utils/environment.py"}], "after_files": [{"content": "# Copyright \u00a9 Michal \u010ciha\u0159 <michal@weblate.org>\n#\n# SPDX-License-Identifier: GPL-3.0-or-later\n\nfrom __future__ import annotations\n\nimport ast\nimport os\n\n\ndef get_env_str(\n    name: str,\n    default: str | None = None,\n    required: bool = False,\n    fallback_name: str | None = None,\n) -> str:\n    file_env = f\"{name}_FILE\"\n    if filename := os.environ.get(file_env):\n        try:\n            with open(filename) as handle:\n                result = handle.read()\n        except OSError as error:\n            raise ValueError(\n                f\"Failed to open {filename} as specified by {file_env}: {error}\"\n            ) from error\n    else:\n        if fallback_name and name not in os.environ:\n            name = fallback_name\n        result = os.environ.get(name, default)\n    if required and not result:\n        raise ValueError(f\"{name} has to be configured!\")\n    return result\n\n\ndef get_env_list(name: str, default: list[str] | None = None) -> list[str]:\n    \"\"\"Helper to get list from environment.\"\"\"\n    if name not in os.environ:\n        return default or []\n    return os.environ[name].split(\",\")\n\n\ndef get_env_map(name: str, default: dict[str, str] | None = None) -> dict[str, str]:\n    \"\"\"\n    Helper to get mapping from environment.\n\n    parses 'full_name:name,email:mail' into {'email': 'mail', 'full_name': 'name'}\n    \"\"\"\n    if os.environ.get(name):\n        return dict(e.split(\":\") for e in os.environ[name].split(\",\"))\n    return default or {}\n\n\ndef get_env_int(name: str, default: int = 0) -> int:\n    \"\"\"Helper to get integer value from environment.\"\"\"\n    if name not in os.environ:\n        return default\n    try:\n        return int(os.environ[name])\n    except ValueError as error:\n        raise ValueError(f\"{name} is not an integer: {error}\") from error\n\n\ndef get_env_float(name: str, default: float = 0.0) -> float:\n    \"\"\"Helper to get float value from environment.\"\"\"\n    if name not in os.environ:\n        return default\n    try:\n        return float(os.environ[name])\n    except ValueError as error:\n        raise ValueError(f\"{name} is not an float: {error}\") from error\n\n\ndef get_env_bool(name: str, default: bool = False) -> bool:\n    \"\"\"Helper to get boolean value from environment.\"\"\"\n    if name not in os.environ:\n        return default\n    true_values = {\"true\", \"yes\", \"1\"}\n    return os.environ[name].lower() in true_values\n\n\ndef modify_env_list(current: list[str], name: str) -> list[str]:\n    \"\"\"Helper to modify list (for example checks).\"\"\"\n    for item in reversed(get_env_list(f\"WEBLATE_ADD_{name}\")):\n        current.insert(0, item)\n    for item in get_env_list(f\"WEBLATE_REMOVE_{name}\"):\n        current.remove(item)\n    return current\n\n\ndef get_env_credentials(\n    name: str,\n) -> dict[str, dict[str, str]]:\n    \"\"\"Parses VCS integration credentials.\"\"\"\n    if credentials := get_env_str(f\"WEBLATE_{name}_CREDENTIALS\"):\n        return ast.literal_eval(credentials)\n    username = os.environ.get(f\"WEBLATE_{name}_USERNAME\")\n    token = os.environ.get(f\"WEBLATE_{name}_TOKEN\")\n    host = os.environ.get(f\"WEBLATE_{name}_HOST\")\n\n    if not host and (username or token):\n        raise ValueError(\n            f\"Incomplete {name}_CREDENTIALS configuration: missing WEBLATE_{name}_HOST\"\n        )\n    return {host: {\"username\": username, \"token\": token}}\n\n\ndef get_env_ratelimit(name: str, default: str) -> str:\n    value = os.environ.get(name, default)\n\n    # Taken from rest_framework.throttling.SimpleRateThrottle.parse_rate\n    # it can not be imported here as that breaks config loading for\n    # rest_framework\n\n    try:\n        num, period = value.split(\"/\")\n    except ValueError as error:\n        raise ValueError(f\"Could not parse {name}: {error}\") from error\n    if not num.isdigit():\n        raise ValueError(f\"Could not parse {name}: rate is not numeric: {num}\")\n    if period[0] not in (\"s\", \"m\", \"h\", \"d\"):\n        raise ValueError(f\"Could not parse {name}: unknown period: {period}\")\n\n    return value\n", "path": "weblate/utils/environment.py"}]}