@mks2508/coolify-mks-cli-mcp 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -28216,7 +28216,28 @@ var CoolifyService = class {
28216
28216
  is_preview: false
28217
28217
  })
28218
28218
  });
28219
- if (result.error) {
28219
+ if (result.error && result.error.includes("already exists")) {
28220
+ const listResult = await this.request(`/applications/${appUuid}/envs`);
28221
+ const existing = listResult.data?.find((v) => v.key === key);
28222
+ if (existing) {
28223
+ const patchResult = await this.request(`/applications/${appUuid}/envs/${existing.uuid}`, {
28224
+ method: "PATCH",
28225
+ body: JSON.stringify({
28226
+ key,
28227
+ value,
28228
+ is_preview: false
28229
+ })
28230
+ });
28231
+ if (patchResult.error) {
28232
+ log.error(`Failed to update env var ${key}: ${patchResult.error}`);
28233
+ return err(new Error(`Failed to update ${key}: ${patchResult.error}`));
28234
+ }
28235
+ log.debug(`Updated existing env var: ${key}`);
28236
+ } else {
28237
+ log.error(`Failed to set env var ${key}: ${result.error}`);
28238
+ return err(new Error(`Failed to set ${key}: ${result.error}`));
28239
+ }
28240
+ } else if (result.error) {
28220
28241
  log.error(`Failed to set env var ${key}: ${result.error}`);
28221
28242
  return err(new Error(`Failed to set ${key}: ${result.error}`));
28222
28243
  }