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

Set overwrite globally #88

Closed
nieomylnieja opened this issue Aug 11, 2023 · 2 comments · Fixed by #97
Closed

Set overwrite globally #88

nieomylnieja opened this issue Aug 11, 2023 · 2 comments · Fixed by #97
Milestone

Comments

@nieomylnieja
Copy link

If a default strategy for filling in env variables values into struct definition is to overwrite them, it would be nice to specify it once when calling envconfig.Process.

@sethvargo
Copy link
Owner

Hi @nieomylnieja - the entire point of this library over others is that it does not overwrite existing struct values unless explicitly given in the struct configuration. You might want to look at kelseyhightower/envconfig, which has the behavior you're looking for. Thanks!

@nieomylnieja
Copy link
Author

hey @sethvargo :) Thanks for the reply! Unfortunately envconfig is no longer maintained, I used it over the years in many projects, but recently I wanted to move to another solution with active maintenance, go-envconfig looks really solid. I understand the default assumptions for this project are different then of kelsehigtowers', however since you've ended up including an option for the overwrite, wouldn't you consider exposing an API to change the defaults for some of the tag options? In general I'm not only talking about overwrite, but also delimiter or separator, having to place these options in tags for each field bloats the struct declaration and prevents the developer from enforcing these rules for the whole struct. I would be more than willing to contribute If you'd be open for such a feature :)

For now I ended up writing a simple version myself.

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

Successfully merging a pull request may close this issue.

2 participants