Skip to content

Commit

Permalink
Add check for default config existence
Browse files Browse the repository at this point in the history
If default config exists try to read it into the config structure else
return a blank config.
  • Loading branch information
AdamBark committed Jul 29, 2020
1 parent 6f83814 commit 193f076
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/pebble/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ const DefaultConfigPath = "test/config/default-config.json"

func getDefaultConfig() config {
var c config
err := cmd.ReadConfigFile(DefaultConfigPath, &c)
cmd.FailOnError(err, "Reading default JSON config file into config structure")
if _, err := os.Stat(DefaultConfigPath); err == nil {
err := cmd.ReadConfigFile(DefaultConfigPath, &c)
cmd.FailOnError(err, "Reading default JSON config file into config structure")
}
return c
}

Expand Down

0 comments on commit 193f076

Please sign in to comment.