Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling config passed via CLI #28

Open
tusharmath opened this issue Mar 12, 2019 · 1 comment
Open

Handling config passed via CLI #28

tusharmath opened this issue Mar 12, 2019 · 1 comment

Comments

@tusharmath
Copy link
Owner

tusharmath commented Mar 12, 2019

Consider a use case where —

default.json

{
  "watch": false,
  "port": 9000
}

Command line

node server.js --port=3000

node-config-ts will automatically override the port value of 9000 with 3000. This is a great feature to have but sometimes it can cause conflicts when the command line argument isn't actually intended to override the config.

For example while running tests for the same server.js as follows —

mocha test/server.test.js --watch

The watch passed is intended to be used by mocha and not by server.js. But in this case
the config object will automatically contain watch property which will be set to true. This can change the behaviour of the program drastically.

@tusharmath tusharmath pinned this issue Mar 21, 2019
@mapuo
Copy link

mapuo commented Mar 28, 2019

Also, specifically boolean and number values are not converted and their typeof shows them as strings while the TypeScript definition is boolean or number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants