fix: read env config

This commit is contained in:
Nite07 2024-11-14 19:04:45 +08:00
parent 5d7f558ed4
commit d500ca7576

View File

@ -7,6 +7,7 @@ import (
"os/exec" "os/exec"
"reflect" "reflect"
"strconv" "strconv"
"strings"
"time" "time"
) )
@ -119,6 +120,11 @@ func loadEnvVariables(cfg interface{}) {
if value, err := strconv.ParseBool(envValue); err == nil { if value, err := strconv.ParseBool(envValue); err == nil {
v.Field(i).SetBool(value) v.Field(i).SetBool(value)
} }
case reflect.Slice:
if field.Type.Elem().Kind() == reflect.String {
envValueSlice := strings.Split(envValue, ",")
v.Field(i).Set(reflect.ValueOf(envValueSlice))
}
} }
} }
} }