init
This commit is contained in:
19
pkg/config/config.go
Normal file
19
pkg/config/config.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var Config *viper.Viper
|
||||
|
||||
func Init(configPath string) error {
|
||||
Config = viper.New()
|
||||
Config.SetConfigFile(configPath)
|
||||
Config.SetConfigType("yaml")
|
||||
|
||||
if err := Config.ReadInConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user