(env string, defaultValue int)
| 125 | } |
| 126 | |
| 127 | func GetOrDefault(env string, defaultValue int) int { |
| 128 | if env == "" || os.Getenv(env) == "" { |
| 129 | return defaultValue |
| 130 | } |
| 131 | num, err := strconv.Atoi(os.Getenv(env)) |
| 132 | if err != nil { |
| 133 | Logger.Error(fmt.Sprintf("failed to parse %s: %s, using default value: %d", env, err.Error(), defaultValue)) |
| 134 | return defaultValue |
| 135 | } |
| 136 | return num |
| 137 | } |
| 138 | |
| 139 | func GetOrDefaultString(env string, defaultValue string) string { |
| 140 | if env == "" || os.Getenv(env) == "" { |