MCPcopy Create free account
hub / github.com/bodhiye/paste / LoadConfig

Function LoadConfig

server/util/service.go:16–26  ·  view source on GitHub ↗

加载配置

(configName string)

Source from the content-addressed store, hash-verified

14
15// 加载配置
16func LoadConfig(configName string) {
17 viper.SetConfigName(configName)
18 viper.AddConfigPath(".")
19 err := viper.ReadInConfig()
20 if err != nil {
21 log.Fatalf("Fatal error config file: %+v", err)
22 }
23
24 level, _ := log.ParseLevel(viper.GetString("log.level")) // 将从配置文件中获取到的日志从字符串转为log.level类型
25 log.SetLevel(level)
26}
27
28// 启动服务器
29func RunServer(srv *http.Server) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected