From 0378d3c100ba130798b68f4fc29b42d225d45fcc Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Tue, 2 May 2023 21:41:46 +0300 Subject: fix: cors origin for steamcommunity --- main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 4f40ba9..915955a 100644 --- a/main.go +++ b/main.go @@ -20,8 +20,8 @@ import ( // @license.name GNU General Public License, Version 2 // @license.url https://www.gnu.org/licenses/old-licenses/gpl-2.0.html -// @host lp.ardapektezol.com/api -// @BasePath /v1 +// @host lp.ardapektezol.com/api +// @BasePath /v1 func main() { if os.Getenv("ENV") == "PROD" { gin.SetMode(gin.ReleaseMode) @@ -31,9 +31,9 @@ func main() { log.Fatal("Error loading .env file") } router := gin.Default() - config := cors.DefaultConfig() - config.AllowedOrigins = []string{"https://steamcommunity.com"} - router.Use(cors.New(config)) + router.Use(cors.New(cors.Config{ + AllowedOrigins: []string{"https://steamcommunity.com"}, + })) database.ConnectDB() // For frontend static serving - only for local debug // router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true))) -- cgit v1.2.3