updated dependencies and go
This commit is contained in:
@@ -101,11 +101,11 @@ func processEnvOverrides(rval reflect.Value, delim string, prefix string) error
|
||||
}
|
||||
|
||||
func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (reflect.Value, error) {
|
||||
if rvtype == reflect.TypeOf("") {
|
||||
if rvtype == reflect.TypeFor[string]() {
|
||||
|
||||
return reflect.ValueOf(envval), nil
|
||||
|
||||
} else if rvtype == reflect.TypeOf(int(0)) {
|
||||
} else if rvtype == reflect.TypeFor[int]() {
|
||||
|
||||
envint, err := strconv.ParseInt(envval, 10, bits.UintSize)
|
||||
if err != nil {
|
||||
@@ -114,7 +114,7 @@ func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (ref
|
||||
|
||||
return reflect.ValueOf(int(envint)), nil
|
||||
|
||||
} else if rvtype == reflect.TypeOf(int64(0)) {
|
||||
} else if rvtype == reflect.TypeFor[int64]() {
|
||||
|
||||
envint, err := strconv.ParseInt(envval, 10, 64)
|
||||
if err != nil {
|
||||
@@ -123,7 +123,7 @@ func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (ref
|
||||
|
||||
return reflect.ValueOf(int64(envint)), nil
|
||||
|
||||
} else if rvtype == reflect.TypeOf(int32(0)) {
|
||||
} else if rvtype == reflect.TypeFor[int32]() {
|
||||
|
||||
envint, err := strconv.ParseInt(envval, 10, 32)
|
||||
if err != nil {
|
||||
@@ -132,7 +132,7 @@ func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (ref
|
||||
|
||||
return reflect.ValueOf(int32(envint)), nil
|
||||
|
||||
} else if rvtype == reflect.TypeOf(int8(0)) {
|
||||
} else if rvtype == reflect.TypeFor[int8]() {
|
||||
|
||||
envint, err := strconv.ParseInt(envval, 10, 8)
|
||||
if err != nil {
|
||||
@@ -141,7 +141,7 @@ func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (ref
|
||||
|
||||
return reflect.ValueOf(int8(envint)), nil
|
||||
|
||||
} else if rvtype == reflect.TypeOf(time.Duration(0)) {
|
||||
} else if rvtype == reflect.TypeFor[time.Duration]() {
|
||||
|
||||
dur, err := timeext.ParseDurationShortString(envval)
|
||||
if err != nil {
|
||||
@@ -159,7 +159,7 @@ func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (ref
|
||||
|
||||
return reflect.ValueOf(tim), nil
|
||||
|
||||
} else if rvtype.ConvertibleTo(reflect.TypeOf(int(0))) {
|
||||
} else if rvtype.ConvertibleTo(reflect.TypeFor[int]()) {
|
||||
|
||||
envint, err := strconv.ParseInt(envval, 10, 8)
|
||||
if err != nil {
|
||||
@@ -170,7 +170,7 @@ func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (ref
|
||||
|
||||
return envcvl, nil
|
||||
|
||||
} else if rvtype.ConvertibleTo(reflect.TypeOf(false)) {
|
||||
} else if rvtype.ConvertibleTo(reflect.TypeFor[bool]()) {
|
||||
|
||||
if strings.TrimSpace(strings.ToLower(envval)) == "true" {
|
||||
return reflect.ValueOf(true).Convert(rvtype), nil
|
||||
@@ -184,7 +184,7 @@ func parseEnvToValue(envval string, fullEnvKey string, rvtype reflect.Type) (ref
|
||||
return reflect.Value{}, errors.New(fmt.Sprintf("Failed to parse env-config variable '%s' to <%s, ,bool> (value := '%s')", rvtype.Name(), fullEnvKey, envval))
|
||||
}
|
||||
|
||||
} else if rvtype.ConvertibleTo(reflect.TypeOf("")) {
|
||||
} else if rvtype.ConvertibleTo(reflect.TypeFor[string]()) {
|
||||
|
||||
envcvl := reflect.ValueOf(envval).Convert(rvtype)
|
||||
return envcvl, nil
|
||||
|
||||
Reference in New Issue
Block a user