Skip to content

Natashkinsasha/node-config-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-config-env-value

A plug-in for config module to add environment variables to the config file.

Installation

Npm

npm install node-config-env-value

Yarn

yarn add node-config-env-value

Quick start

default.json

{
    "server":{
        "hostname": "localhost",
        "port": 3000
    },
    "string": "test",
    "number": 4,
    "boolean": true,
}

package.json

    ...
    "scripts": {
        "start": "server={port:4000} string=test2 number=1 boolean=false node index.js",
    },
    ...

index.js

var config = require('node-config-env-value');

var NODE_ENV = config.get('NODE_ENV');

console.log(config)
/*
    Config {
        server: { hostname: 'localhost', port: 4000 },
        number: 1,
        boolean: false
        string: 'test2'
        ALLUSERSPROFILE: 'C:\\ProgramData',
        APPDATA: 'C:\\Users\\User\\AppData\\Roaming',
        ...
    }
*/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published