Go config is a simple configuration solution for Go application using Viper and Consul KV
- Reading config from file or Consul KV
- Support JSON, TOML, YAML, HCL, envfile and Java properties config files
go get github.com/dungps/config
- Reading config from file
err := config.LoadConfigFrom(config.FileType, "./sample.yaml")
if err != nil {
// handle err
}
viper.GetBool("hello")
- Reading config from Consul KV
err := config.LoadConfigFrom(config.ConsulType, "/sample.yaml,/local.yaml")
if err != nil {
// handle err
}
viper.GetBool("hello")