Simple, extremely lightweight, extensible, configuration management library for Go. Support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.
MIT License
2.71k
stars
150
forks
source link
Discuss: return `error` for ` Provider(cfg Config)` #233
almost all the provider func returns the object without error
example:
func Provider(cfg Config) *Vault {
...
}
I'm thinking of returning an error along with provider object:
func Provider(cfg Config) (*Vault, error) {
...
}
i think the original func signature support the inline the Provider instantiation within k.Load(...), but for Vault, S3 and other providers relies on the external system, it pretty much return nil if something wrong in the config or network, etc.
hence a panic threw out and the app process gets exit.
@knadh i'd like to discuss the API change
almost all the provider func returns the object without error
example:
I'm thinking of returning an error along with provider object:
i think the original func signature support the inline the Provider instantiation within
k.Load(...)
, but for Vault, S3 and other providers relies on the external system, it pretty much returnnil
if something wrong in the config or network, etc. hence a panic threw out and the app process gets exit.it's not very friendly to diagnose the issue.