One build per environment: PROD_* variables for the production artifact, TEST_* for the test build and the CSP check. The build fails when a variable is empty. Tests use the production values from config/monitoringTestEnv.ts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
19 lines
792 B
TypeScript
19 lines
792 B
TypeScript
// Schrijft de webserverconfiguratie naar deploy/ (pnpm server-config).
|
|
// Draait direct met Node (type stripping), zonder extra tooling.
|
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
import { dirname } from 'node:path';
|
|
import { monitoringTestEnv } from './monitoringTestEnv.ts';
|
|
import { serverConfigFiles } from './serverConfig.ts';
|
|
|
|
// The committed files carry the CSP of the production build; the origins of
|
|
// Umami and Sentry come from the environment (src/monitoring/config.ts)
|
|
for (const [name, value] of Object.entries(monitoringTestEnv)) {
|
|
process.env[name] ??= value;
|
|
}
|
|
|
|
for (const [path, generate] of Object.entries(serverConfigFiles)) {
|
|
mkdirSync(dirname(path), { recursive: true });
|
|
writeFileSync(path, generate());
|
|
console.log(`Geschreven: ${path}`);
|
|
}
|