mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 20:54:48 -04:00
change(rewrite): Rename parseIntOrThrow
to parseInteger
This commit is contained in:
parent
c1d6551301
commit
336ddb9408
@ -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),
|
||||
|
@ -29,7 +29,7 @@ export function toLowerCase<S extends string>(value: S): Lowercase<S> {
|
||||
return value.toLowerCase() as Lowercase<S>;
|
||||
}
|
||||
|
||||
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)`
|
||||
|
Loading…
x
Reference in New Issue
Block a user