From d500ca757649f7a78f777c153183a27552720c3a Mon Sep 17 00:00:00 2001 From: nite07 Date: Thu, 14 Nov 2024 19:04:45 +0800 Subject: [PATCH] fix: read env config --- config/config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/config.go b/config/config.go index ab251ee..e034f15 100644 --- a/config/config.go +++ b/config/config.go @@ -7,6 +7,7 @@ import ( "os/exec" "reflect" "strconv" + "strings" "time" ) @@ -119,6 +120,11 @@ func loadEnvVariables(cfg interface{}) { if value, err := strconv.ParseBool(envValue); err == nil { 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)) + } } } }