| 72 | } |
| 73 | |
| 74 | func getBoolValue(envKey string, flagVal bool) bool { |
| 75 | var res bool |
| 76 | |
| 77 | // If defined, take the env variable |
| 78 | if _, ok := os.LookupEnv(envKey); ok { |
| 79 | switch os.Getenv(envKey) { |
| 80 | case "": |
| 81 | res = false |
| 82 | case "0": |
| 83 | res = false |
| 84 | case "false": |
| 85 | res = false |
| 86 | case "FALSE": |
| 87 | res = false |
| 88 | case "1": |
| 89 | res = true |
| 90 | default: |
| 91 | // catches "true", "TRUE" or anything else |
| 92 | res = true |
| 93 | |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | // If a flag is specified, this value takes precedence |
| 98 | if res != flagVal { |
| 99 | res = flagVal |
| 100 | } |
| 101 | |
| 102 | return res |
| 103 | } |
| 104 | |
| 105 | func stringToIntArray(l string, sep string) ([]int, error) { |
| 106 | var err error |