Make CORS used outside of development env
This commit is contained in:
parent
9dd320108f
commit
cd9de6d578
@ -25,13 +25,13 @@ func init() {
|
|||||||
Data: assets.Favicon,
|
Data: assets.Favicon,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if config.Environment == "development" {
|
app.Use(cors.New(cors.Config{
|
||||||
app.Use(cors.New(cors.Config{
|
AllowOrigins: "*",
|
||||||
AllowOrigins: "*",
|
AllowMethods: "HEAD,OPTIONS,GET,POST",
|
||||||
AllowMethods: "HEAD,OPTIONS,GET",
|
ExposeHeaders: "X-Cache-Hit,X-Cache-Time-Remaining",
|
||||||
ExposeHeaders: "X-Cache-Hit,X-Cache-Time-Remaining",
|
}))
|
||||||
}))
|
|
||||||
|
|
||||||
|
if config.Environment == "development" {
|
||||||
app.Use(logger.New(logger.Config{
|
app.Use(logger.New(logger.Config{
|
||||||
Format: "${time} ${ip}:${port} -> ${status}: ${method} ${path} (${latency})\n",
|
Format: "${time} ${ip}:${port} -> ${status}: ${method} ${path} (${latency})\n",
|
||||||
TimeFormat: "2006/01/02 15:04:05",
|
TimeFormat: "2006/01/02 15:04:05",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user