22 lines
402 B
Go
22 lines
402 B
Go
package infrastructure
|
|
|
|
import (
|
|
"github.com/knadh/koanf"
|
|
"github.com/knadh/koanf/providers/env"
|
|
"strings"
|
|
)
|
|
|
|
func NewConfig() *koanf.Koanf {
|
|
config := koanf.New(".")
|
|
|
|
loadValues(config)
|
|
|
|
return config
|
|
}
|
|
|
|
func loadValues(c *koanf.Koanf) {
|
|
envProvider := env.Provider("", ".", func(s string) string {
|
|
return strings.Replace(strings.ToLower(s), "_", ".", -1)
|
|
})
|
|
_ = c.Load(envProvider, nil)
|
|
}
|