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

When value defined in multiple backend, last one wins #64

Closed
dmaciel opened this issue Aug 1, 2019 · 2 comments · Fixed by #65
Closed

When value defined in multiple backend, last one wins #64

dmaciel opened this issue Aug 1, 2019 · 2 comments · Fixed by #65

Comments

@dmaciel
Copy link

dmaciel commented Aug 1, 2019

This was previously discussed in #7, but my tests are giving different results, If I define a variable in a file as an env var, the last backend on the list wins

Examples:
l := confita.NewLoader(file.NewBackend(path),env.NewBackend())
in this case the env backend overwrites the values in the file files

n := confita.NewLoader(env.NewBackend(),file.NewBackend(path))
same issue here, the file will overwrite any value previously set as env var

The docs say: "Confita scans a struct for config tags and calls all the backends one after another until the key is found" from my understanding once found it stops and continue looking for the next config key

There is a working example of the issue:

https://play.golang.org/p/c8l9NbRnJOT

Thanks to @rogpeppe for your go playground example on issue 61

@ahmedsharif865
Copy link

Is someone still working on this issue?

@steamrolla
Copy link
Contributor

@dmaciel @ahmedsharif865 should be fixed with the above PR. Just needs to get merged 😃.

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.

3 participants