features.go 438 B

123456789101112131415161718192021222324252627
  1. package watch
  2. import (
  3. "os"
  4. "strconv"
  5. )
  6. const CheckLimitKey = "WM_CHECK_LIMIT"
  7. var limitChecksEnabled = true
  8. // Allows limit checks to be disabled for testing.
  9. func SetLimitChecksEnabled(enabled bool) {
  10. limitChecksEnabled = enabled
  11. }
  12. func LimitChecksEnabled() bool {
  13. env, ok := os.LookupEnv(CheckLimitKey)
  14. if ok {
  15. enabled, err := strconv.ParseBool(env)
  16. if err == nil {
  17. return enabled
  18. }
  19. }
  20. return limitChecksEnabled
  21. }