From f775405a017888bcbdefba1a28d5525bb8b9194e Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Mon, 3 Aug 2026 01:32:41 +0200 Subject: [PATCH] deploy.py: 409 Conflict Handling (POST -> PATCH bei existierenden ENVs) --- scripts/deploy.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index 6e15ea9..0a7c717 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -329,13 +329,22 @@ def deploy_worker(client: CoolifyClient, skip_build: bool = False) -> StepResult # Step 3: Set ENV variables via Coolify API (Coolify auto-generates .env) print(" Setting ENV variables via Coolify API...") for env in WORKER_ENVS: - # POST creates or updates the ENV variable + # POST creates the ENV variable; if it already exists (409), + # PATCH updates it resp = httpx.post( f"{client.base_url}/api/v1/services/{WORKER_UUID}/envs", headers=client.headers, json=env, timeout=30, ) + if resp.status_code == 409: + # Already exists — update via PATCH + resp = httpx.patch( + f"{client.base_url}/api/v1/services/{WORKER_UUID}/envs", + headers=client.headers, + json=env, + timeout=30, + ) if resp.status_code not in (200, 201): print(f" Warning: could not set ENV {env['key']} ({resp.status_code})")