1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-04 21:42:57 +02:00

add json.NewValues to config

This commit is contained in:
asim
2025-05-05 14:39:54 +01:00
parent 23b14123ea
commit ef4dc8b5b0

View File

@ -21,6 +21,15 @@ type jsonValue struct {
*simple.Json *simple.Json
} }
func NewValues(val []byte) (reader.Values, error) {
sj := simple.New()
data, _ := reader.ReplaceEnvVars(val)
if err := sj.UnmarshalJSON(data); err != nil {
sj.SetPath(nil, string(data))
}
return &jsonValues{sj: sj}, nil
}
func newValues(ch *source.ChangeSet) (reader.Values, error) { func newValues(ch *source.ChangeSet) (reader.Values, error) {
sj := simple.New() sj := simple.New()
data, _ := reader.ReplaceEnvVars(ch.Data) data, _ := reader.ReplaceEnvVars(ch.Data)