aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.go b/main.go
index aae2a18..4f40ba9 100644
--- a/main.go
+++ b/main.go
@@ -5,6 +5,7 @@ import (
5 "log" 5 "log"
6 "os" 6 "os"
7 7
8 "github.com/gin-gonic/contrib/cors"
8 "github.com/gin-gonic/gin" 9 "github.com/gin-gonic/gin"
9 "github.com/joho/godotenv" 10 "github.com/joho/godotenv"
10 "github.com/pektezol/leastportals/backend/database" 11 "github.com/pektezol/leastportals/backend/database"
@@ -19,8 +20,8 @@ import (
19// @license.name GNU General Public License, Version 2 20// @license.name GNU General Public License, Version 2
20// @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 21// @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 22
22// @host lp.ardapektezol.com/api 23// @host lp.ardapektezol.com/api
23// @BasePath /v1 24// @BasePath /v1
24func main() { 25func main() {
25 if os.Getenv("ENV") == "PROD" { 26 if os.Getenv("ENV") == "PROD" {
26 gin.SetMode(gin.ReleaseMode) 27 gin.SetMode(gin.ReleaseMode)
@@ -30,6 +31,9 @@ func main() {
30 log.Fatal("Error loading .env file") 31 log.Fatal("Error loading .env file")
31 } 32 }
32 router := gin.Default() 33 router := gin.Default()
34 config := cors.DefaultConfig()
35 config.AllowedOrigins = []string{"https://steamcommunity.com"}
36 router.Use(cors.New(config))
33 database.ConnectDB() 37 database.ConnectDB()
34 // For frontend static serving - only for local debug 38 // For frontend static serving - only for local debug
35 // router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true))) 39 // router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true)))