1.0.1 • Published 6 years ago

sconfigger v1.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

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.

1.0.1

6 years ago

1.0.0

6 years ago