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

Improve variable expansion in AddConfigPath #1062

Closed
sagikazarmark opened this issue Jan 13, 2021 · 2 comments · Fixed by #1063
Closed

Improve variable expansion in AddConfigPath #1062

sagikazarmark opened this issue Jan 13, 2021 · 2 comments · Fixed by #1063
Labels
kind/enhancement New feature or request

Comments

@sagikazarmark
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Variable expansion used in AddConfigPath is a bit weird.

Describe the solution you'd like to see
Try to improve the variable expansion code. Eg. use os.ExpandEnv

@sagikazarmark sagikazarmark added the kind/enhancement New feature or request label Jan 13, 2021
Repository owner deleted a comment from github-actions bot Jan 13, 2021
serazoli added a commit to serazoli/viper that referenced this issue Jan 15, 2021
@esammer
Copy link

esammer commented Apr 9, 2021

Just bumped into this with an env var that didn't end in the path separator. I think @serazoli's PR fixes this, but for posterity, the following currently fails: AddConfigPath("$SOMETHING"). A temporary workaround is to append a trailing path separator: AddConfigPath("$SOMETHING/").

sagikazarmark pushed a commit that referenced this issue Sep 19, 2021
@sagikazarmark
Copy link
Collaborator Author

@esammer for the record, the provided fix will continue failing if the env var value is empty, hence you might still need the trailing separator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants