diff options
Diffstat (limited to 'config.go')
-rw-r--r-- | config.go | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -32,27 +32,23 @@ type DatabaseConfig struct { func GetRuntimeConfig() RuntimeConfig { - // init empty return value config := RuntimeConfig{} - // read command line flags - flag.StringVar(&config.Path, "c", "/etc/ceres/config.json", "Path to ceres configuration file") + flag.StringVar(&config.Path, "c", "/etc/ceres/config.json", + "Path to ceres configuration file") flag.Parse() - // open config file configFile, err := os.Open(config.Path) defer configFile.Close() if err != nil { log.Fatalf("Could not open configuration file %s", config.Path) } - // read byte content configData, err := ioutil.ReadAll(configFile) if err != nil { log.Fatalf("Could not read configuration file %s", config.Path) } - // parse content to config structs err = json.Unmarshal(configData, &config) if err != nil { log.Fatalf("Could not parse configuration file %s", config.Path) |