From 5fb01a06581dd8130ae6873462147f29d20e6ad4 Mon Sep 17 00:00:00 2001 From: fu_changjie <834876355@qq.com> Date: Tue, 15 Dec 2020 17:17:31 +0800 Subject: [PATCH] fix: absolute Paths conf.WebDir --- api/conf/conf.go | 2 +- api/internal/route.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/conf/conf.go b/api/conf/conf.go index 6ea9af02de..2b26e5c821 100644 --- a/api/conf/conf.go +++ b/api/conf/conf.go @@ -36,7 +36,7 @@ const ( EnvDEV = "dev" EnvLOCAL = "local" - WebDir = "./html" + WebDir = "/html" ) var ( diff --git a/api/internal/route.go b/api/internal/route.go index a57e5c0e0a..dd0e54cd6d 100644 --- a/api/internal/route.go +++ b/api/internal/route.go @@ -49,9 +49,9 @@ func SetUpRouter() *gin.Engine { store := cookie.NewStore([]byte("secret")) r.Use(sessions.Sessions("session", store)) r.Use(filter.CORS(), filter.RequestId(), filter.RequestLogHandler(logger), filter.SchemaCheck(), filter.Authentication(), filter.RecoverHandler()) - r.Use(static.Serve("/", static.LocalFile(conf.WebDir, false))) + r.Use(static.Serve("/", static.LocalFile(conf.WorkDir + conf.WebDir, false))) r.NoRoute(func(c *gin.Context) { - c.File(fmt.Sprintf("%s/index.html", conf.WebDir)) + c.File(fmt.Sprintf("%s/index.html", conf.WorkDir + conf.WebDir)) }) factories := []handler.RegisterFactory{