sourcen übernommen und wieder compilierbar gemacht.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func InitConfig(fileName string) *viper.Viper {
|
||||
config := viper.New()
|
||||
config.SetConfigName(fileName)
|
||||
config.AddConfigPath(".")
|
||||
config.AddConfigPath("$HOME")
|
||||
err := config.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Fatal("Error while parsing configuration file! ", err)
|
||||
}
|
||||
return config
|
||||
}
|
||||
Reference in New Issue
Block a user