arnaucube
arnaucube/goBlockchainDataAnalysisPublic Self-hosted repository
goBlockchainDataAnalysis/readConfig.go
readConfig.goRaw
 1package main
 2
 3import (
 4	"encoding/json"
 5	"io/ioutil"
 6)
 7
 8type Config struct {
 9	User           string `json:"user"`
10	Pass           string `json:"pass"`
11	Host           string `json:"host"`
12	Port           string `json:"port"`
13	GenesisTx      string `json:"genesisTx"`
14	GenesisBlock   string `json:"genesisBlock"`
15	StartFromBlock int64  `json:"startFromBlock"`
16}
17
18var config Config
19
20func readConfig(path string) {
21	file, err := ioutil.ReadFile(path)
22	check(err)
23	content := string(file)
24	json.Unmarshal([]byte(content), &config)
25}