Tell the user if given an invalid / non-existant config file (fix #29)

This commit is contained in:
Noah 2024-03-27 10:21:56 -05:00
parent e72171f1ef
commit 2edf00073f
2 changed files with 8 additions and 1 deletions

View File

@ -82,6 +82,13 @@ func main() {
return return
} }
if exists, err := fileExists(*config_path); !exists {
fmt.Printf("Invalid config file '%s'\n", *config_path)
os.Exit(1)
} else if err != nil {
panic(err)
}
parseConfig(*config_path, &configuration) // Parse JSON configuration file parseConfig(*config_path, &configuration) // Parse JSON configuration file
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // Webhook receiver http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // Webhook receiver