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

Defaults to current dir #69

Closed
bep opened this issue May 13, 2015 · 10 comments
Closed

Defaults to current dir #69

bep opened this issue May 13, 2015 · 10 comments
Labels
kind/bug Something isn't working

Comments

@bep
Copy link
Collaborator

bep commented May 13, 2015

Viper defaults to loading config.toml (if that is the config name set) from the current directory.

This is very confusing if you have several applications using Viper, and your command prompt happen to be in "the other one".

@bep bep added the kind/bug Something isn't working label May 13, 2015
@kzvezdarov
Copy link
Contributor

@bep I did that as part of fixing #32. Maybe we should revert it and require that pwd is manually added to the search path? I wasn't aware what the expected behavior was supposed to be at the time.

@didenko
Copy link
Collaborator

didenko commented May 22, 2015

I second this bug. As I mentioned in #55 (comment) this bug is a source of failures and confusion.

To answer the comment from @kzvezdarov in #55 (comment) I have to note, that many programs which read config do not use command-line parameters (CLP) to override all, especially sensitive, aspects of configuration. And that is often a good thing operationally.

I am glad that viper does not require to match all config entries with CLPs - and that CLPs are not part of the viper package.

@bep
Copy link
Collaborator Author

bep commented May 22, 2015

@kzvezdarov The current behavior is no-no; I have started to write small CLI Go apps for many tasks now, and I scratched my head a few times until I understood what happened.

If someone wants to add pwd to the config path, make them do it manually.

@kzvezdarov
Copy link
Contributor

@didenko good call. #72 removes CWD from the default path @bep
Will merge once tests pass.

@didenko
Copy link
Collaborator

didenko commented May 22, 2015

@kzvezdarov great, thank you! Looking forward to pull it.

@bep
Copy link
Collaborator Author

bep commented May 22, 2015

Merged.

@bep bep closed this as completed May 22, 2015
@didenko
Copy link
Collaborator

didenko commented May 22, 2015

Not sure if that belongs to this or new bug - viper still defaults to current dir if no directories specified or all specified directories do not exist. The former case is not of huge concern. The latter (non-existing directories) is.

@kzvezdarov
Copy link
Contributor

@bep
Copy link
Collaborator Author

bep commented May 22, 2015

Yea, well - that one I an live with, as I always set a config path. It's definitively another issue (a related one).

@didenko
Copy link
Collaborator

didenko commented May 22, 2015

OK, posted #73 for the follow-up issue. Thank you for clarifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants