Skip to content

Repository files navigation

@prestonarnold/config

An easy to use configuration management library for Node.js applications.

Installation

npm install @prestonarnold/config

OR

yarn add @prestonarnold/config

Usage

import{validate}from"@prestonarnold/validate";import{createConfig}from"@prestonarnold/config";constuserSchema=validate.object({PORT: validate.number().default(3000),NODE_ENV: validate.string().default("development"),});constconfig=createConfig({schema: userSchema,validator: (data,schema)=>{constres=schema.parse(data);if(!res.success)thrownewError(res.errors.join(", "));returnres.data;},sources: ['env',// process.env'file:.env',// dotenv],})console.log(config.get('PORT'));console.log(config.get('NODE_ENV'));console.log(config.all());

About

An easy to use configuration management library for Node.js applications.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages