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