load-envs
v1.0.0
Published
# What this package does
Downloads
4
Readme
load-envs
What this package does
It loads and validate environment variables
How To Use
import { loadEnvs } from "load-envs";
// declare Env type
interface Env {
NODE_ENV: string;
PLAIN: string;
A_NUMBER: number;
WITH_DEFAULT: string;
}
const env = loadEnvs<Env>([
{
envKey: "NODE_ENV",
options: {
validValues: ["production", "development"],
},
},
{
envKey: "PLAIN",
},
{
envKey: "A_NUMBER",
options: {
isNumber: true,
}
},
{
envKey: "WITH_DEFAULT",
options: {
defaultValue: "something"
}
},
]);
export default env;