1.0.7 • Published 3 years ago

run-with-envs v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

run-with-envs

run-with-env is a command line tool which converts the content of a JSON file to env variables and pass them to a node process.

Installation

$ npm install -g run-with-envs

Execute a node application with envs

$ run-with-envs {path-to-config-json-file}

A config file could look like this (config.json):

{
  "PORT": 4000,
  "TEST": {
    "API": "/api",
    "HOSTS": {
        "CUSTOMER_ONE": "one.test.com",
        "CUSTOMER_TWO": "two.test.com",
        "CUSTOMER_THREE": "three.test.com"
    }
}

resulting node call with the config file above:

$ PORT="4000" TEST_API="/api" TEST_HOST_CUSTOMER_ONE="one.test.com" TEST_HOST_CUSTOMER_TWO="two.test.com" node ./index.js

The entries of sub objects with plural name will be converted to an enviroment variable each:

{
  "HOSTS": {
    "CUSTOMER_ONE": "one.test.com",
    "CUSTOMER_TWO": "two.test.com"
  }
}

Become:

$ TEST_HOST_CUSTOMER_ONE="one.test.com" TEST_HOST_CUSTOMER_TWO="two.test.com" node ./index.js

Specify the executable file

With the option -r you can set a path to a executable js file

$ run-with-envs -r {path-to-executable} {path-to-config-json-file}

License

MIT

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago