fix: classify upstream failures and prevent empty billed responses
This commit is contained in:
1 parent
b455d8d79f
commit
9acc69d4c7
28 files changed
+1449
-131
No files matched your search
@@ -66,6 +66,16 @@ def load_config(env_file, mode):
|
||||
fail("Environment file missing. Run: python3 deploy.py init")
|
||||
if os.name != "nt" and stat.S_IMODE(env_file.stat().st_mode) & 0o077:
|
||||
fail("Environment file must be private. Run chmod 600 on it.")
|
||||
# A later empty assignment silently overrides an earlier valid secret in
|
||||
# Compose. Reject duplicates before resolving or starting any container.
|
||||
seen = set()
|
||||
for line in env_file.read_text(encoding="utf-8-sig").splitlines():
|
||||
match = re.match(r"^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=", line)
|
||||
if match:
|
||||
key = match.group(1)
|
||||
if key in seen:
|
||||
fail("Duplicate environment setting: " + key + ". Keep exactly one assignment; values are not printed.")
|
||||
seen.add(key)
|
||||
config = execute(compose_command(env_file, mode) + ["config", "--format", "json"], capture=True)
|
||||
resolved = json.loads(config)
|
||||
# Compose serializes literal '$' as '$$' for re-parseable config output.
|
||||
|
||||
Reference in new issue
Block a user