Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix views path while running

goenning54b854a48fbb
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 6cacdb0f0..d6fec8b5e 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -6,7 +6,8 @@
"**/.hg": true,
"**/.DS_Store": true,
"data": true,
- "vendor": true,
+ "vendor/g*": true,
+ "vendor/vendor.json": false,
"gin-bin": true,
"wchy": true,
"tmp": true
diff --git a/handlers/router.go b/handlers/router.go
index 60fdab583..e4a31050a 100644
--- a/handlers/router.go
+++ b/handlers/router.go
@@ -40,7 +40,13 @@ func GetMainEngine(ctx context.WchyContext) *gin.Engine {
router := gin.New()
router.Use(gin.Logger())
router.Use(multiTenant(ctx))
- router.LoadHTMLGlob(filepath.Join(os.Getenv("GOPATH"), "src/github.com/WeCanHearYou/wchy/views/*"))
+
+ goEnv := os.Getenv("GO_ENV")
+ if goEnv == "test" {
+ router.LoadHTMLGlob(filepath.Join(os.Getenv("GOPATH"), "src/github.com/WeCanHearYou/wchy/views/*"))
+ } else {
+ router.LoadHTMLGlob("views/*")
+ }
router.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl", gin.H{