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

config: it's not possible to override defaults via argv #7492

Closed
kirrg001 opened this issue Oct 5, 2016 · 3 comments
Closed

config: it's not possible to override defaults via argv #7492

kirrg001 opened this issue Oct 5, 2016 · 3 comments
Labels
bug [triage] something behaving unexpectedly

Comments

@kirrg001
Copy link
Contributor

kirrg001 commented Oct 5, 2016

node index.js --url=my-url won't override the default url.
Thanks @sebgie for reporting.

With current usage of nconf, somehow file is always stronger then argv - maybe it's caused by how nconf create's in memory stores in combination of how we are using nconf.

Will work on a solution for that.

Workaround could be for now:
touch config.development.json
echo "{\"url\": \".....\"}" | config.development.json

@kirrg001 kirrg001 added the bug [triage] something behaving unexpectedly label Oct 5, 2016
@ErisDS ErisDS added the config label Oct 5, 2016
kirrg001 added a commit to kirrg001/Ghost that referenced this issue Oct 5, 2016
refs TryGhost#7492
- this is just a temporary solution
ErisDS pushed a commit that referenced this issue Oct 5, 2016
refs #7492

- this is just a temporary solution
mixonic pushed a commit to mixonic/Ghost that referenced this issue Oct 28, 2016
refs TryGhost#7492

- this is just a temporary solution
geekhuyang pushed a commit to geekhuyang/Ghost that referenced this issue Nov 20, 2016
refs TryGhost#7492

- this is just a temporary solution
@vivekannan
Copy link
Contributor

vivekannan commented Jan 11, 2017

OK. Really weird. nconf looks through the different "stores" that it has (argv, env, files etc) for the given key (in this case url). The problem is, it returns the value found in the first store that has the given key.

When you configure the files as numbers (1, 2, 3, 4), they come before argv alphanumerically speaking. So the url in 1 (which is one of the config files) is returned. On the other hand when they are configured as ghost1, ghost2 etc, they come after argv. So argv's url is returned. Not sure if this is the expected behaviour......

EDIT: I could be wrong. The behavior is very strange.

@kirrg001
Copy link
Contributor Author

@vivekannan
The alphanumeric assumption is an interesting fact and might explain the behaviour, but as you pointed out: this shouldn't be expected?

The good thing for now is: with ghost1, ghost2.. keys, argv overrides work.

The PR is still open because we would like to figure out why. If you can find more, please share. Very appreciating your help. From next week on we will work again on Ghost 1.0 issues, bugs (config bugs etc.) and features.

@kirrg001
Copy link
Contributor Author

Closing. I've added a reference into the configuration audit issue #7488
This helps getting a better issue overview for our upcoming 1.0 releases.

Any further conversations, can still happen here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly
Projects
None yet
Development

No branches or pull requests

3 participants