fenv
v2.1.7
Published
Package to configure enviroment variables
Downloads
13
Maintainers
Readme
Fenv
Package to configure enviroment variables
Usage examples
envConfig({
port: ["APP_PORT", Number],
dbUrl: ["DATABASE_URL", String],
socket: {
ip: ["SOCKET_IP", (value: string) => value.replace("http://", "")],
number: ["SOCKET_NUMBER", (value: string) => !Number.isNaN(Number(value))],
},
});
// example with zod
envConfig({
port: ["APP_PORT", z.coerce.number().int().positive().parse],
dbUrl: ["DATABASE_URL", z.string().trim().parse],
socket: {
ip: ["SOCKET_IP", z.string().ip().parse],
},
});