blockchainIDsystem/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 ServerIP string `json:"serverip"`
13 ServerPort string `json:"serverport"`
14}
15
16var config Config
17
18func readConfig(path string) {
19 file, err := ioutil.ReadFile(path)
20 check(err)
21 content := string(file)
22 json.Unmarshal([]byte(content), &config)
23}