Skip to content

Commit

Permalink
Ignore error if default config file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
mrueg committed Apr 25, 2023
1 parent 2f44bcb commit 4c3d417
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ func main() {
filePath := context.String("config")
return altsrc.NewTomlSourceFromFile(filePath)
} else {
// Fall back to default if config is unset
// Fall back to default if config is unset and path exists
_, err := os.Stat(filepath.Join(os.Getenv("HOME"), ".config/mark"))
if os.IsNotExist(err) {
return &altsrc.MapInputSource{}, nil
}
return altsrc.NewTomlSourceFromFile(filepath.Join(os.Getenv("HOME"), ".config/mark"))
}
}),
Expand Down

0 comments on commit 4c3d417

Please sign in to comment.