Dump changes
This commit is contained in:
parent
e12550a643
commit
aac2ea1b74
25 changed files with 129 additions and 76 deletions
22
pkg/brainbuffer/infrastructure/config.go
Normal file
22
pkg/brainbuffer/infrastructure/config.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue