diff --git a/youtube_collection_server/main.go b/youtube_collection_server/main.go index ace4605..b6281b8 100644 --- a/youtube_collection_server/main.go +++ b/youtube_collection_server/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" utils "youtube_collection_server/Utils" - . "youtube_collection_server/config" + config "youtube_collection_server/config" "youtube_collection_server/controller" "youtube_collection_server/middle" @@ -11,22 +11,22 @@ import ( ) func main() { - InitConfig() + config.InitConfig() // 创建一个默认的路由引擎 router := gin.Default() //初始化路由 initRouter(router) - Logger.Infof("服务器启动成功...端口:%d", MyEnv.Server.Port) + config.Logger.Infof("服务器启动成功...端口:%d", config.MyEnv.Server.Port) router.Use(middle.Cors()) - err := router.Run(fmt.Sprintf(":"+"%d", MyEnv.Server.Port)) + err := router.Run(fmt.Sprintf(":"+"%d", config.MyEnv.Server.Port)) if err != nil { - Logger.Error("服务器启动失败") + config.Logger.Error("服务器启动失败") return } } func initRouter(router *gin.Engine) { - router.Use(utils.LoggerToFile(MyEnv.Log.LogEnv, MyEnv.Log.LogPath)) + router.Use(utils.LoggerToFile(config.MyEnv.Log.LogEnv, config.MyEnv.Log.LogPath)) noAuth := router.Group("") { noAuth.GET("/test", controller.UserController.Test)