initial crm server

This commit is contained in:
zchengo
2022-11-28 16:38:30 +08:00
parent 61122aef6a
commit af7cd0c44c
36 changed files with 2615 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package initialize
import (
"crm/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 resources file: %s \n", err.Error())
}
if err := viper.Unmarshal(&global.Config); err != nil {
fmt.Printf("unable to decode into struct %s \n", err.Error())
}
}