mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -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 {
|
import {
|
||||||
identity,
|
identity,
|
||||||
parseBool,
|
parseBool,
|
||||||
parseIntOrThrow,
|
parseInteger,
|
||||||
toLowerCase,
|
toLowerCase,
|
||||||
} from "@pronounspage/common/util";
|
} from "@pronounspage/common/util";
|
||||||
import * as path from "node:path";
|
import * as path from "node:path";
|
||||||
@ -84,7 +84,7 @@ export function loadConfigFromEnv(): Config {
|
|||||||
http: {
|
http: {
|
||||||
baseUrl: envVarNotNull("HTTP_BASE_URL", identity),
|
baseUrl: envVarNotNull("HTTP_BASE_URL", identity),
|
||||||
host: envVarOrDefault("HTTP_HOST", identity, "0.0.0.0"),
|
host: envVarOrDefault("HTTP_HOST", identity, "0.0.0.0"),
|
||||||
port: envVarOrDefault("HTTP_PORT", parseIntOrThrow, 4000),
|
port: envVarOrDefault("HTTP_PORT", parseInteger, 4000),
|
||||||
},
|
},
|
||||||
security: {
|
security: {
|
||||||
secret: envVarNotNull("SECRET", identity),
|
secret: envVarNotNull("SECRET", identity),
|
||||||
|
@ -29,7 +29,7 @@ export function toLowerCase<S extends string>(value: S): Lowercase<S> {
|
|||||||
return value.toLowerCase() as 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)) {
|
if (radix != null && (radix < 2 || radix > 36)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`invalid radix ${radix} - must be between 2 and 36 (inclusive)`
|
`invalid radix ${radix} - must be between 2 and 36 (inclusive)`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user