File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1267,11 +1267,13 @@ func (v *Viper) MergeConfig(in io.Reader) error {
12671267}
12681268
12691269// MergeConfigMap merges the configuration from the map given with an existing config.
1270+ // Note that the map given may be modified.
12701271func MergeConfigMap (cfg map [string ]interface {}) error { return v .MergeConfigMap (cfg ) }
12711272func (v * Viper ) MergeConfigMap (cfg map [string ]interface {}) error {
12721273 if v .config == nil {
12731274 v .config = make (map [string ]interface {})
12741275 }
1276+ insensitiviseMap (cfg )
12751277 mergeMaps (cfg , v .config , nil )
12761278 return nil
12771279}
Original file line number Diff line number Diff line change @@ -1252,15 +1252,22 @@ func TestMergeConfigMap(t *testing.T) {
12521252 assert (37890 )
12531253
12541254 update := map [string ]interface {}{
1255- "hello" : map [string ]interface {}{
1256- "pop" : 1234 ,
1255+ "Hello" : map [string ]interface {}{
1256+ "Pop" : 1234 ,
1257+ },
1258+ "World" : map [interface {}]interface {}{
1259+ "Rock" : 345 ,
12571260 },
12581261 }
12591262
12601263 if err := v .MergeConfigMap (update ); err != nil {
12611264 t .Fatal (err )
12621265 }
12631266
1267+ if rock := v .GetInt ("world.rock" ); rock != 345 {
1268+ t .Fatal ("Got rock:" , rock )
1269+ }
1270+
12641271 assert (1234 )
12651272
12661273}
You can’t perform that action at this time.
0 commit comments