diff --git a/src/config/config.service.ts b/src/config/config.service.ts index 13ddb8d..a84e5b2 100644 --- a/src/config/config.service.ts +++ b/src/config/config.service.ts @@ -12,8 +12,19 @@ export class ConfigService { this.host = process.env.HOST || "0.0.0.0"; this.port = Number(process.env.PORT) || 8080; - this.reverse_proxy = Boolean(process.env.REVERSE_PROXY) || false; + this.reverse_proxy = this.parseBool(process.env.REVERSE_PROXY, false); - this.proxy_res = Boolean(process.env.PROXY_RES) || true; + this.proxy_res = this.parseBool(process.env.PROXY_RES, true); + } + + parseBool(value: string | undefined, def: boolean): boolean { + if (!value) return def; + switch (value) { + case "false": + case "0": + return false; + default: + return Boolean(value); + } } }