blockchainIDsystem/serverIDsigner/readConfig.go
serverIDsigner/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 WebServerPort string `json:"webserverport"`
13 Mongodb MongoConfig `json:"mongodb"`
14}
15type MongoConfig struct {
16 IP string `json:"ip"`
17 Database string `json:"database"`
18}
19
20var config Config
21
22func readConfig(path string) {
23 file, err := ioutil.ReadFile(path)
24 check(err)
25 content := string(file)
26 json.Unmarshal([]byte(content), &config)
27}