Skip to content
Snippets Groups Projects
Commit a604811f authored by Ophestra's avatar Ophestra
Browse files

Merge branch 'cors-disable' into 'main'

feat(conf): do not insert CORS middleware if ALLOWED_URL is "unset"

See merge request !11
parents b6b899f1 4170ffb5
No related branches found
Tags v0.0.4
1 merge request!11feat(conf): do not insert CORS middleware if ALLOWED_URL is "unset"
Pipeline #989 passed
......@@ -17,10 +17,14 @@ func serve(sig chan os.Signal, db *leveldb.DB) error {
app := fiber.New()
// cors
app.Use(cors.New(cors.Config{
AllowOrigins: []string{conf[allowedURL]},
AllowHeaders: []string{"Origin", "Content-Type", "Accept"},
}))
if conf[allowedURL] != "unset" {
app.Use(cors.New(cors.Config{
AllowOrigins: []string{conf[allowedURL]},
AllowHeaders: []string{"Origin", "Content-Type", "Accept"},
}))
} else {
log.Println("CORS disabled")
}
var captcha fiber.Handler
hCaptchaEnable := conf[hCaptchaSiteKey] != "unset" && conf[hCaptchaSecretKey] != "unset"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment