diff --git a/src/Libraries/Environment.ts b/src/Libraries/Environment.ts index fbd22c69..a1fb6431 100644 --- a/src/Libraries/Environment.ts +++ b/src/Libraries/Environment.ts @@ -19,6 +19,9 @@ export function getEnvironmentVariable(key: string, parse?: if (value === undefined && optional !== true) { throw new Error(`Config Exception: Missing ${key} variable in configuration`); } + if (value === undefined && optional === true) { + return undefined as any; + } return parse ? parse(value) : envToString(value); }