From 0f64e03181209e1add52af5e46fc4ea3fb5018ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BA=AE=E4=BA=AE?= Date: Sat, 11 May 2024 11:02:12 +0800 Subject: [PATCH] healthy --- controller/CategoryController.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/controller/CategoryController.go b/controller/CategoryController.go index 6b6643b..16aebcd 100644 --- a/controller/CategoryController.go +++ b/controller/CategoryController.go @@ -22,6 +22,10 @@ func (c CategoryController) Show(ctx *gin.Context) { urlPath := "" urlPath = ctx.Request.URL.Path //fmt.Println(urlPath) + if "/healthy" == urlPath { + ctx.Writer.WriteString("ok") + return + } if strings.HasPrefix(urlPath, "/static") { if _, err := os.Stat("." + urlPath); err == nil { @@ -32,10 +36,7 @@ func (c CategoryController) Show(ctx *gin.Context) { } } rootDir := viper.GetString("dir.root") - message := template.HTML("") - if "" != viper.GetString("message") { - message = template.HTML(viper.GetString("message")) - } + message := template.HTML(viper.GetString("message")) path := rootDir + urlPath pathInfo, err := os.Stat(path) listResult := util.GetFileList(path)