Skip to content

deHugo/better-app-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Better App Config

Purpose

This module tries to improve upon the 'config' npm module by adding getter functions, runtime config modifications, and default config values.

Installation

From your project's root, run the following.

npm install --save better-app-config

Usage

Require the module and then pass it a reference to your app. It will attach itself to app.config by default.

const config  = require("better-app-config")
const express = require("express")

const app = express()


config(app)

To set defaults, call the defaults method, passing it the path and the defaults.

app.config.defaults("log_level", "info")
app.config.defaults("server", {
	hostname: "localhost",
	port: 8080,
	protocol: "http:"
})

To retrieve a config value, use the get method and pass the path of the config.

let jwtConfig = app.config.get("jwt.options")

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors