1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Package golangorgenv provides environment information for programs running at
6 // golang.org and its subdomains.
16 checkCountry = boolEnv("GOLANGORG_CHECK_COUNTRY")
17 enforceHosts = boolEnv("GOLANGORG_ENFORCE_HOSTS")
20 // CheckCountry reports whether country restrictions should be enforced.
21 func CheckCountry() bool {
25 // EnforceHosts reports whether host filtering should be enforced.
26 func EnforceHosts() bool {
30 func boolEnv(key string) bool {
33 // TODO(dmitshur): In the future, consider detecting if running in App Engine,
34 // and if so, making the environment variables mandatory rather than optional.
37 b, err := strconv.ParseBool(v)
39 log.Fatalf("environment variable %s (%q) must be a boolean", key, v)