diff --git a/new/backend/src/config.ts b/new/backend/src/config.ts index 885efebfc..27382d069 100644 --- a/new/backend/src/config.ts +++ b/new/backend/src/config.ts @@ -2,7 +2,7 @@ import "dotenv/config"; import { identity, parseBool, - parseIntOrThrow, + parseInteger, toLowerCase, } from "@pronounspage/common/util"; import * as path from "node:path"; @@ -84,7 +84,7 @@ export function loadConfigFromEnv(): Config { http: { baseUrl: envVarNotNull("HTTP_BASE_URL", identity), host: envVarOrDefault("HTTP_HOST", identity, "0.0.0.0"), - port: envVarOrDefault("HTTP_PORT", parseIntOrThrow, 4000), + port: envVarOrDefault("HTTP_PORT", parseInteger, 4000), }, security: { secret: envVarNotNull("SECRET", identity), diff --git a/new/common/src/util.ts b/new/common/src/util.ts index 4e4ddc6a3..4ed7518d6 100644 --- a/new/common/src/util.ts +++ b/new/common/src/util.ts @@ -29,7 +29,7 @@ export function toLowerCase(value: S): Lowercase { return value.toLowerCase() as Lowercase; } -export function parseIntOrThrow(value: string, radix?: number): number { +export function parseInteger(value: string, radix?: number): number { if (radix != null && (radix < 2 || radix > 36)) { throw new Error( `invalid radix ${radix} - must be between 2 and 36 (inclusive)`