Skip to content
Snippets Groups Projects
Verified Commit 4170ffb5 authored by Ophestra's avatar Ophestra
Browse files

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


This allows easy disablement of CORS for testing.

Signed-off-by: default avatarOphestra Umiker <cat@ophivana.moe>
parent b6b899f1
Branches
Tags
1 merge request!11feat(conf): do not insert CORS middleware if ALLOWED_URL is "unset"
Pipeline #987 passed
......@@ -17,10 +17,14 @@ func serve(sig chan os.Signal, db *leveldb.DB) error {
app := fiber.New()
// cors
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.
Please register or to comment