diff --git a/pkg/config/geo_gate.go b/pkg/config/geo_gate.go index c329d59..7750e3f 100644 --- a/pkg/config/geo_gate.go +++ b/pkg/config/geo_gate.go @@ -1,6 +1,7 @@ package config // GeoIP gating rules. TODO: make dynamically configurable. +var GeoGateEnabled bool // GeoIP database path (standard location on Fedora/Debian) const GeoIPPath = "/usr/share/GeoIP/GeoLite2-City.mmdb" diff --git a/pkg/middleware/geo_gate.go b/pkg/middleware/geo_gate.go index 83fe7ed..19e4026 100644 --- a/pkg/middleware/geo_gate.go +++ b/pkg/middleware/geo_gate.go @@ -14,6 +14,10 @@ import ( // GeoGate: block access to the site based on the user's location (due to local laws or regulations). func GeoGate(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if !config.GeoGateEnabled { + handler.ServeHTTP(w, r) + return + } // Flash errors to admins. onError := func(err error) {