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

Create an abstraction for config loading #889

Open
sagikazarmark opened this issue Apr 9, 2020 · 2 comments
Open

Create an abstraction for config loading #889

sagikazarmark opened this issue Apr 9, 2020 · 2 comments

Comments

@sagikazarmark
Copy link
Collaborator

Configuration sources are hard-wired into the core of Viper. Similarly to encoding, not all sources might be necessary all the time, particularly remote sources, which actually pull in a large number of dependencies.

One of the goals of Viper 2 is lowering the number of dependencies and this is an area where we can do that, by creating a similar, library based solution to encoding.

Since every configuration internally is represented as map[string]interface{}, the interface could be as simple as:

type Loader interface {
	Load() (map[string]interface{}, error)
}

This would also be a step towards a better API.

Similarly to encoding, for the time being this should also be backwards compatible with Viper 1, so:

  • the library should be in the same Viper module
  • the library must only add (but at least retain) functionality
  • the library should go under github.com/spf13/viper/internal for the time being

The internal library also allows us to compare the new library to the old implementation first, without exposing it.

@shaj13
Copy link

shaj13 commented Oct 15, 2020

@sagikazarmark
let me know how I can help with v2, tried to push a commit to #772 but it's limited to collaborators.

@lucasoares
Copy link

Any timeline on this @sagikazarmark ?

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

No branches or pull requests

3 participants