github.com/bytom/bytom@v1.1.2-0.20221014091027-bbcba3df6075/toolbar/vote_reward/config/config.go (about) 1 package config 2 3 import ( 4 "encoding/json" 5 "os" 6 7 "github.com/bytom/bytom/toolbar/common" 8 ) 9 10 type Config struct { 11 NodeIP string `json:"node_ip"` 12 ChainID string `json:"chain_id"` 13 MySQLConfig common.MySQLConfig `json:"mysql"` 14 RewardConf *RewardConfig `json:"reward_config"` 15 } 16 17 type RewardConfig struct { 18 XPub string `json:"xpub"` 19 AccountID string `json:"account_id"` 20 Password string `json:"password"` 21 MiningAddress string `json:"mining_address"` 22 RewardRatio uint64 `json:"reward_ratio"` 23 } 24 25 func LoadConfigFile(configFile string, config *Config) error { 26 file, err := os.Open(configFile) 27 if err != nil { 28 return err 29 } 30 defer file.Close() 31 32 return json.NewDecoder(file).Decode(config) 33 }