Skip to content

Commit

Permalink
[FAB-17900] Fixes numeric env variable override bug
Browse files Browse the repository at this point in the history
Signed-off-by: Tiffany Harris <[email protected]>
  • Loading branch information
stephyee authored and sykesm committed May 29, 2020
1 parent 7199378 commit adf7436
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion common/viperutil/config_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func getKeysRecursively(base string, getKey viperGetter, nodeKeys map[string]int

func unmarshalJSON(val interface{}) (map[string]string, bool) {
mp := map[string]string{}

s, ok := val.(string)
if !ok {
logger.Debugf("Unmarshal JSON: value is not a string: %v", val)
Expand Down Expand Up @@ -303,7 +304,7 @@ func bccspHook(f reflect.Type, t reflect.Type, data interface{}) (interface{}, e

config := factory.GetDefaultOpts()

err := mapstructure.Decode(data, config)
err := mapstructure.WeakDecode(data, config)
if err != nil {
return nil, errors.Wrap(err, "could not decode bcssp type")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/peer/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func InitCrypto(mspMgrConfigDir, localMSPID, localMSPType string) error {
SetBCCSPKeystorePath()
bccspConfig := factory.GetDefaultOpts()
if config := viper.Get("peer.BCCSP"); config != nil {
err = mapstructure.Decode(config, bccspConfig)
err = mapstructure.WeakDecode(config, bccspConfig)
if err != nil {
return errors.WithMessage(err, "could not decode peer BCCSP configuration")
}
Expand Down

0 comments on commit adf7436

Please sign in to comment.