12345678910111213141516171819 |
- package initialize
- import (
- "AIT/global"
- "fmt"
- "github.com/spf13/viper"
- )
- func LoadConfig() {
- viper.AddConfigPath("./")
- viper.SetConfigName("config")
- viper.SetConfigType("yaml")
- if err := viper.ReadInConfig(); err != nil {
- fmt.Printf("Fatal error resource file: %s \n\n", err.Error())
- }
- if err := viper.Unmarshal(&global.Config); err != nil {
- fmt.Printf("Unable to decode into structure Config %s \n", err.Error())
- }
- }
|