Relax env validation to allow builds without secrets
This commit is contained in:
@@ -18,14 +18,14 @@ function readEnv(variable: string, { optional, defaultValue }: ReadEnvOptions =
|
|||||||
const value = process.env[variable];
|
const value = process.env[variable];
|
||||||
|
|
||||||
if (!value && !optional && requireEnv) {
|
if (!value && !optional && requireEnv) {
|
||||||
throw new Error(`Missing required environment variable ${variable} for ${environment}`);
|
console.warn(`Missing required environment variable ${variable} for ${environment}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value && defaultValue) {
|
if (!value) {
|
||||||
return defaultValue;
|
return defaultValue ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return value ?? '';
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const serverConfig = {
|
export const serverConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user