From 91c955e52e5fb50ad5d0ea62f89d74bf0a51944e Mon Sep 17 00:00:00 2001 From: "Demi [Alvaro Martinez de Miguel]" Date: Wed, 16 Oct 2019 14:25:20 +0200 Subject: [PATCH] Update congif to support CORS --- config/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/config.go b/config/config.go index 1694e33..1f3d7a6 100644 --- a/config/config.go +++ b/config/config.go @@ -23,6 +23,7 @@ var ( TLSKey string `yaml:"tls-key"` URLPrefix string `yaml:"url-prefix"` Referrers []string `yaml:"referrers"` + Cors bool `yaml:cors` } ) @@ -36,6 +37,7 @@ const ( tlsCertKey = "TLS_CERT" tlsKeyKey = "TLS_KEY" urlPrefixKey = "URL_PREFIX" + corsKey = "CORS" ) var ( @@ -48,6 +50,7 @@ var ( defaultTLSCert = "" defaultTLSKey = "" defaultURLPrefix = "" + defaultCors = false ) func init() { @@ -65,6 +68,7 @@ func setDefaults() { Get.TLSCert = defaultTLSCert Get.TLSKey = defaultTLSKey Get.URLPrefix = defaultURLPrefix + Get.Cors = defaultCors } // Load the configuration file. @@ -113,6 +117,7 @@ func overrideWithEnvVars() { Get.TLSKey = envAsStr(tlsKeyKey, Get.TLSKey) Get.URLPrefix = envAsStr(urlPrefixKey, Get.URLPrefix) Get.Referrers = envAsStrSlice(referrersKey, Get.Referrers) + Get.Cors = envAsBool(corsKey, Get.Cors) } // validate the configuration.