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
Closed

Improve variable expansion in AddConfigPath #1062

sagikazarmark opened this issue Jan 13, 2021 · 2 comments

Comments

@sagikazarmark
Copy link
Collaborator

@sagikazarmark sagikazarmark commented Jan 13, 2021

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

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 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/").

Loading

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

@sagikazarmark sagikazarmark commented Sep 19, 2021

@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.

Loading

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

Successfully merging a pull request may close this issue.

2 participants