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"`
14 MinIOAddress string `json: "minio-address"`
15 MinIOPort string `json: "minio-port"`
16 AccessKeyID string `json: "access-key-id"`
17 SecretAccessKey string `json: "secret-access-key"`
20 var gConfig *Configuration
22 func readConfigFile(file string) (*Configuration, error) {
23 f, err := os.Open(file)
25 return defaultConfiguration(), err
29 conf := defaultConfiguration()
31 decoder := json.NewDecoder(f)
32 err = decoder.Decode(conf)
40 func defaultConfiguration() *Configuration {
41 return &Configuration {
43 DatabaseAddress: "127.0.0.1",
44 DatabaseType: "mongo",
46 MinIOAddress: "127.0.0.1",
48 AccessKeyID: "ICN-ACCESSKEYID",
49 SecretAccessKey: "ICN-SECRETACCESSKEY",
53 func GetConfiguration() *Configuration {
55 conf, err := readConfigFile("ICNconfig.json")
57 log.Println("Error loading config file. Using defaults")