9 type Configuration struct {
10 Password string `json: "password"`
11 DatabaseAddress string `json: "database-address"`
12 DatabaseType string `json: "database-type"`
13 ServicePort string `json: "service-port"`
16 var gConfig *Configuration
18 func readConfigFile(file string) (*Configuration, error) {
19 f, err := os.Open(file)
21 return defaultConfiguration(), err
25 conf := defaultConfiguration()
27 decoder := json.NewDecoder(f)
28 err = decoder.Decode(conf)
36 func defaultConfiguration() *Configuration {
37 return &Configuration {
39 DatabaseAddress: "127.0.0.1",
40 DatabaseType: "mongo",
45 func GetConfiguration() *Configuration {
47 conf, err := readConfigFile("ICNconfig.json")
49 log.Println("Error loading config file. Using defaults")