aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/main.go b/main.go
index 21786e8..59ccfa5 100644
--- a/main.go
+++ b/main.go
@@ -1,17 +1,24 @@
1package main 1package main
2 2
3import ( 3import (
4 "log"
5 "os"
6
4 "github.com/gin-gonic/contrib/static" 7 "github.com/gin-gonic/contrib/static"
5 "github.com/gin-gonic/gin" 8 "github.com/gin-gonic/gin"
6 "github.com/pektezol/leastportals/backend/controllers" 9 "github.com/joho/godotenv"
7 "github.com/pektezol/leastportals/backend/database" 10 "github.com/pektezol/leastportals/backend/database"
8 "github.com/pektezol/leastportals/backend/routes" 11 "github.com/pektezol/leastportals/backend/routes"
9) 12)
10 13
11func main() { 14func main() {
12 if controllers.GetEnvKey("ENV") == "PROD" { 15 if os.Getenv("ENV") == "PROD" {
13 gin.SetMode(gin.ReleaseMode) 16 gin.SetMode(gin.ReleaseMode)
14 } 17 }
18 err := godotenv.Load()
19 if err != nil {
20 log.Fatal("Error loading .env file")
21 }
15 router := gin.Default() 22 router := gin.Default()
16 database.ConnectDB() 23 database.ConnectDB()
17 router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true))) 24 router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true)))