Skip to content

galmeiri/sconfigger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

sconfigger

A simple and smart config loader

The package takes a JSON config file and returns a parsed config object. Sconfigger knows to automatically parse values with $ sign followed by capital letters from the process environment.

NPM Version

Simple usage

const sconfigger = require("sconfigger");  
const config = sconfigger("app.config.json"); // Default config file name is equivalent to <mainModuleName>.config.json. There is no need to specify this path.

Installation

npm install sconfigger --save

Usage examples

"app.config.json" contains the following JSON:

{
    "db": {
        "host": "$DATABASE_HOST",
        "username": "$DATABASE_USER",
        "password": "$DATABASE_PASSWORD",
    },
    "safe": "I am just a regular text"
}

Where $DATABASE_HOST, $DATABASE_USER, $DATABASE_PASSWORD will be set in the process env.

About

A simple and smart config loader

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published