Change frontend .env files to be committed and have .env.*.local overrides (#6207)

This commit is contained in:
James Brunton
2026-04-25 13:09:59 +01:00
committed by GitHub
parent 276bbd635c
commit 1e3da14081
11 changed files with 77 additions and 123 deletions
+6 -12
View File
@@ -49,30 +49,24 @@ function findViteEnvVars(srcDir: string): Set<string> {
describe("env vars", () => {
it("every VITE_ var used in source is present in an example env file", () => {
const baseEnv = readFileSync(
join(frontendRoot, "config/.env.example"),
"utf-8",
);
const baseEnv = readFileSync(join(frontendRoot, ".env"), "utf-8");
const desktopEnv = readFileSync(
join(frontendRoot, "config/.env.desktop.example"),
"utf-8",
);
const saasEnv = readFileSync(
join(frontendRoot, "config/.env.saas.example"),
join(frontendRoot, ".env.desktop"),
"utf-8",
);
const saasEnv = readFileSync(join(frontendRoot, ".env.saas"), "utf-8");
const exampleKeys = new Set([
const declaredKeys = new Set([
...parseEnvKeys(baseEnv),
...parseEnvKeys(desktopEnv),
...parseEnvKeys(saasEnv),
]);
const sourceVars = findViteEnvVars(join(frontendRoot, "src"));
const missing = [...sourceVars].filter((v) => !exampleKeys.has(v));
const missing = [...sourceVars].filter((v) => !declaredKeys.has(v));
expect(
missing,
`Missing from 'frontend/config/.env.example' files: ${missing.join(", ")}`,
`Missing from 'frontend/.env*' files: ${missing.join(", ")}`,
).toHaveLength(0);
});
});