- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for GetEnvAsIntOrFallback (0.19 sec)
-
pkg/util/env/env_test.go
key := "FLOCKER_SET_VAR" t.Setenv(key, strconv.Itoa(expected)) returnVal, _ := GetEnvAsIntOrFallback(key, 1) assert.Equal(expected, returnVal) key = "FLOCKER_UNSET_VAR" returnVal, _ = GetEnvAsIntOrFallback(key, expected) assert.Equal(expected, returnVal) key = "FLOCKER_SET_VAR" t.Setenv(key, "not-an-int") returnVal, err := GetEnvAsIntOrFallback(key, 1) assert.Equal(expected, returnVal) if err == nil {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Apr 18 01:39:46 UTC 2023 - 2.1K bytes - Viewed (0) -
pkg/util/env/env.go
if v := os.Getenv(key); v != "" { return v } return defaultValue } // GetEnvAsIntOrFallback returns the env variable (parsed as integer) for // the given key and falls back to the given defaultValue if not set func GetEnvAsIntOrFallback(key string, defaultValue int) (int, error) { if v := os.Getenv(key); v != "" { value, err := strconv.Atoi(v) if err != nil {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Fri Sep 27 15:25:19 UTC 2019 - 1.6K bytes - Viewed (0)