From 4fd208ba46e71be8bf68181bdd789773a53c659e Mon Sep 17 00:00:00 2001 From: aichy126 <16996097+aichy126@users.noreply.github.com> Date: Thu, 15 Dec 2022 16:48:07 +0800 Subject: [PATCH] fix dev code --- internal/base/server/http.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/internal/base/server/http.go b/internal/base/server/http.go index 7e0d3296..f1e4eadf 100644 --- a/internal/base/server/http.go +++ b/internal/base/server/http.go @@ -3,7 +3,6 @@ package server import ( "html/template" "io/fs" - "os" brotli "github.com/anargu/gin-brotli" "github.com/answerdev/answer/internal/base/middleware" @@ -32,15 +31,9 @@ func NewHTTPServer(debug bool, r.Use(brotli.Brotli(brotli.DefaultCompression)) r.GET("/healthz", func(ctx *gin.Context) { ctx.String(200, "OK") }) - dev := os.Getenv("DEVCODE") - if dev != "" { - r.SetFuncMap(funcMap) - r.LoadHTMLGlob("../../ui/template/*") - } else { - html, _ := fs.Sub(ui.Template, "template") - htmlTemplate := template.Must(template.New("").Funcs(funcMap).ParseFS(html, "*")) - r.SetHTMLTemplate(htmlTemplate) - } + html, _ := fs.Sub(ui.Template, "template") + htmlTemplate := template.Must(template.New("").Funcs(funcMap).ParseFS(html, "*")) + r.SetHTMLTemplate(htmlTemplate) viewRouter.Register(r)