node-config-env-value
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

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',
        ...
    }
*/

Readme

Keywords

none

Package Sidebar

Install

npm i node-config-env-value

Weekly Downloads

1

Version

2.0.6

License

ISC

Unpacked Size

5.55 kB

Total Files

4

Last publish

Collaborators

  • natashkinsasha