Make CORS used outside of development env

This commit is contained in:
Jacob Gunther 2024-02-05 22:58:20 -06:00
parent 9dd320108f
commit cd9de6d578
No known key found for this signature in database
GPG Key ID: 3F72AFAF0F74E5FD

View File

@ -25,13 +25,13 @@ func init() {
Data: assets.Favicon,
}))
if config.Environment == "development" {
app.Use(cors.New(cors.Config{
AllowOrigins: "*",
AllowMethods: "HEAD,OPTIONS,GET",
ExposeHeaders: "X-Cache-Hit,X-Cache-Time-Remaining",
}))
app.Use(cors.New(cors.Config{
AllowOrigins: "*",
AllowMethods: "HEAD,OPTIONS,GET,POST",
ExposeHeaders: "X-Cache-Hit,X-Cache-Time-Remaining",
}))
if config.Environment == "development" {
app.Use(logger.New(logger.Config{
Format: "${time} ${ip}:${port} -> ${status}: ${method} ${path} (${latency})\n",
TimeFormat: "2006/01/02 15:04:05",