feat: config file

This commit is contained in:
2024-01-20 02:09:29 -06:00
parent 5697c880e0
commit 2079aa4685
4 changed files with 40 additions and 6 deletions

24
internal/config/config.go Normal file
View File

@@ -0,0 +1,24 @@
package config
import (
"github.com/knadh/koanf"
)
var (
K = koanf.New(".")
)
type Config struct {
API struct {
URL string `koanf:"url"`
Token string `koanf:"token"`
} `koanf:"api"`
}
func LoadConfig(provider koanf.Provider, parser koanf.Parser) error {
return K.Load(provider, parser)
}
func Unmarshal(o interface{}) error {
return K.Unmarshal("", o)
}