Skip to content

Commit

Permalink
[remoteWallets] refs#295 Propertly load remote wallets config
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevMac committed Feb 15, 2020
1 parent 32fd1cc commit a9c92bf
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/coin/skycoin/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
SectionName = "skycoin"
SettingPathToLog = "log"
SettingPathToNode = "node"
SettingNodeAddress = "address"
SettingPathToWalletSource = "walletSource"
)

Expand Down Expand Up @@ -139,10 +140,31 @@ func GetWalletSources() ([]*walletSource, error) {
if err != nil {
return nil, err
}
if wltSrcs[i].Tp == RemoteWallet {
node, err := GetNodeSource()
if err != nil {
return nil, err
}
wltSrcs[i].Source = node[SettingNodeAddress]
}
}
return wltSrcs, nil
}

func GetNodeSource() (map[string]string, error) {

nodeSettingStr, err := GetOption(SettingPathToNode)
if err != nil {
return nil, err
}
node := make(map[string]string)
err = json.Unmarshal([]byte(nodeSettingStr), &node)
if err != nil {
return nil, err
}
return node, nil
}

type walletSource struct {
id string
Tp string `json:"SourceType"`
Expand Down

0 comments on commit a9c92bf

Please sign in to comment.