package router import ( "api/config" "api/utils" "log" "net/http" "time" ) func InitGlobalVariable() { // 初始化 Viper utils.InitViper() } func Server() *http.Server { serverPort := config.Cfg.Server.ServerPort log.Printf("服务启动于 %s 端口", serverPort) return &http.Server{ Addr: serverPort, Handler: ServerRouter(), ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second, } }