OSDN Git Service

versoin1.1.9 (#594)
[bytom/vapor.git] / toolbar / consensusreward / config / config.go
1 package config
2
3 import (
4         "encoding/json"
5         "os"
6 )
7
8 func LoadConfigFile(configFile string, config *Config) error {
9         file, err := os.Open(configFile)
10         if err != nil {
11                 return err
12         }
13         defer file.Close()
14
15         return json.NewDecoder(file).Decode(config)
16 }
17
18 type Config struct {
19         NodeIP     string        `json:"node_ip"`
20         RewardConf *RewardConfig `json:"reward_config"`
21 }
22
23 type RewardConfig struct {
24         Node      []NodeConfig `json:"node"`
25         AccountID string       `json:"account_id"`
26         Password  string       `json:"password"`
27 }
28
29 type NodeConfig struct {
30         XPub    string `json:"xpub"`
31         Address string `json:"address"`
32 }