Skip to content

Commit 6152b2f

Browse files
committed
Don’t error when setting TRIGGER_SECRET_KEY or TRIGGER_API_URL env vars, just filter them out
1 parent ec8381e commit 6152b2f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,13 @@ export class EnvironmentVariablesRepository implements Repository {
9191
return { success: false as const, error: `Environment not found` };
9292
}
9393

94-
// Check to see if any of the variables are `TRIGGER_SECRET_KEY` or `TRIGGER_API_URL`
95-
const triggerKeys = options.variables.map((v) => v.key);
96-
if (triggerKeys.includes("TRIGGER_SECRET_KEY") || triggerKeys.includes("TRIGGER_API_URL")) {
97-
return {
98-
success: false as const,
99-
error: `You cannot set the variables TRIGGER_SECRET_KEY or TRIGGER_API_URL as they will be set automatically`,
100-
};
101-
}
94+
// Remove `TRIGGER_SECRET_KEY` or `TRIGGER_API_URL`
95+
let values = options.variables.filter(
96+
(v) => v.key !== "TRIGGER_SECRET_KEY" && v.key !== "TRIGGER_API_URL"
97+
);
10298

10399
//get rid of empty variables
104-
const values = options.variables.filter((v) => v.key.trim() !== "" && v.value.trim() !== "");
100+
values = options.variables.filter((v) => v.key.trim() !== "" && v.value.trim() !== "");
105101
if (values.length === 0) {
106102
return { success: false as const, error: `You must set at least one value` };
107103
}

0 commit comments

Comments
 (0)