@@ -139,25 +139,39 @@ func normalizeKeys(config *koanf.Koanf) {
139139// Transforms Children of path
140140func transformChildren (config * koanf.Koanf , path string , transform func (key string , value any ) (string , any )) error {
141141 var sub map [string ]any
142- if err := config .Unmarshal (path , & sub ); err != nil {
142+
143+ err := config .Unmarshal (path , & sub )
144+
145+ if err != nil {
143146 return err
144147 }
145148
149+ log .Dev (utils .ToJson (sub ))
150+
146151 transformed := make (map [string ]any )
152+
147153 for key , val := range sub {
148154 newKey , newVal := transform (key , val )
149155
150156 transformed [newKey ] = newVal
157+
158+ log .Dev (newKey )
151159 }
160+
161+ log .Dev (utils .ToJson (transformed ))
152162
153163 config .Load (confmap .Provider (map [string ]any {
154164 path : map [string ]any {},
155165 }, "." ), nil )
156166
167+ log .Dev ("1:\n " + utils .ToJson (config .All ()))
168+
157169 config .Load (confmap .Provider (map [string ]any {
158170 path : transformed ,
159171 }, "." ), nil )
160172
173+ log .Dev ("2:\n " + utils .ToJson (config .All ()))
174+
161175 return nil
162176}
163177
@@ -170,17 +184,10 @@ func transformChildrenUnderArray(config *koanf.Koanf, root string, subPath strin
170184 return err
171185 }
172186
173- log .Dev ("Len: " + strconv .Itoa (len (array )))
174-
175- log .Dev (utils .ToJson (array ))
176-
177187 for i := range array {
178188 path := root + "." + strconv .Itoa (i ) + "." + subPath
179189
180- log .Dev (path )
181-
182190 if config .Exists (path ) {
183- log .Dev ("Exists" )
184191 transformChildren (config , path , transform )
185192 }
186193 }
0 commit comments