Only apply CORS headers in development

This commit is contained in:
Jacob Gunther
2023-01-18 22:06:03 -06:00
parent 65676c1683
commit 4f5a106186

View File

@@ -44,13 +44,14 @@ func init() {
log.Println("Successfully retrieved EULA blocked servers") log.Println("Successfully retrieved EULA blocked servers")
app.Use(recover.New()) app.Use(recover.New())
if config.Environment == "development" {
app.Use(cors.New(cors.Config{ app.Use(cors.New(cors.Config{
AllowOrigins: "*", AllowOrigins: "*",
AllowMethods: "HEAD,OPTIONS,GET", AllowMethods: "HEAD,OPTIONS,GET",
ExposeHeaders: "Content-Type,X-Cache-Time-Remaining", ExposeHeaders: "Content-Type,X-Cache-Time-Remaining",
})) }))
if config.Environment == "development" {
app.Use(logger.New(logger.Config{ app.Use(logger.New(logger.Config{
Format: "${time} ${ip}:${port} -> ${method} ${path} -> ${status}\n", Format: "${time} ${ip}:${port} -> ${method} ${path} -> ${status}\n",
TimeFormat: "2006/01/02 15:04:05", TimeFormat: "2006/01/02 15:04:05",