bc/peer/readConfig.go
peer/readConfig.goRaw
1package main
2
3import (
4 "encoding/json"
5 "io/ioutil"
6)
7
8//Config reads the config
9type Config struct {
10 IP string `json:"ip"`
11 Port string `json:"port"`
12 RestIP string `json:"restip"`
13 RESTPort string `json:"restport"`
14 ServerIP string `json:"serverip"`
15 ServerPort string `json:"serverport"`
16 ServerRESTPort string `json:"serverrestport"`
17}
18
19var config Config
20
21func readConfig(path string) {
22 file, err := ioutil.ReadFile(path)
23 check(err)
24 content := string(file)
25 json.Unmarshal([]byte(content), &config)
26}