fix: classify upstream failures and prevent empty billed responses

This commit is contained in:
wlx committed 2026-09-28 04:55:00 +08:00
1 parent b455d8d79f
commit 9acc69d4c7
28 files changed
+1449 -131

No files matched your search

+8 -2
View File
@@ -52,8 +52,14 @@ def updated_environment(original, account, password):
require(password.strip() and not any(ord(char) < 32 or ord(char) == 127 for char in password),
"Password must be nonblank and cannot contain control characters.")
require(password != "admin123", "The development default password is not allowed.")
# Append effective overrides, then ask Compose to validate them. Do not parse
# or rewrite arbitrary existing dotenv values, which may be multiline/quoted.
# Replace the two owner settings in place before appending the effective
# values. Compose accepts later overrides, but duplicate assignments make
# the resulting dotenv file ambiguous and can silently mask a real secret.
# Do not parse or rewrite arbitrary existing dotenv values, which may be
# multiline/quoted.
lines = [line for line in original.splitlines() if not re.match(
r"^\s*(?:export\s+)?(?:ADMIN_ACCOUNT|ADMIN_PASSWORD)\s*=", line)]
original = "\n".join(lines)
values = {"ADMIN_ACCOUNT": account, "ADMIN_PASSWORD": password}
return original.rstrip("\r\n") + "\n\n# Owner credentials set by admin_credentials.py\n" + "".join(
key + "=" + json.dumps(value, ensure_ascii=False).replace("$", "$$") + "\n"