From 4f5a10618614462bd7ef1e0df3903531a7a79f72 Mon Sep 17 00:00:00 2001 From: Jacob Gunther Date: Wed, 18 Jan 2023 22:06:03 -0600 Subject: [PATCH] Only apply CORS headers in development --- src/main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.go b/src/main.go index 0f16cf2..33a8740 100644 --- a/src/main.go +++ b/src/main.go @@ -44,13 +44,14 @@ func init() { log.Println("Successfully retrieved EULA blocked servers") app.Use(recover.New()) - app.Use(cors.New(cors.Config{ - AllowOrigins: "*", - AllowMethods: "HEAD,OPTIONS,GET", - ExposeHeaders: "Content-Type,X-Cache-Time-Remaining", - })) if config.Environment == "development" { + app.Use(cors.New(cors.Config{ + AllowOrigins: "*", + AllowMethods: "HEAD,OPTIONS,GET", + ExposeHeaders: "Content-Type,X-Cache-Time-Remaining", + })) + app.Use(logger.New(logger.Config{ Format: "${time} ${ip}:${port} -> ${method} ${path} -> ${status}\n", TimeFormat: "2006/01/02 15:04:05",