25 lines
395 B
Go
25 lines
395 B
Go
package conf
|
|
|
|
import (
|
|
"github.com/gookit/config/v2"
|
|
"github.com/gookit/config/v2/yaml"
|
|
"github.com/kataras/golog"
|
|
)
|
|
|
|
var cfgPath string
|
|
var App *config.Config
|
|
|
|
func LoadConfig(path string) *config.Config {
|
|
App = config.New("appCfg")
|
|
cfgPath = path
|
|
App.AddDriver(yaml.Driver)
|
|
|
|
err := App.LoadFiles(path)
|
|
|
|
if err != nil {
|
|
golog.Fatalf("Error loading config: %v", err)
|
|
}
|
|
|
|
return App
|
|
}
|