mirror of
https://github.com/adnanh/webhook.git
synced 2025-10-04 21:51:02 +00:00
Fix error on unrecognized configuration keys
- Error while loading configuration with unrecognized keys - Do not start if failed to load configuration from file
This commit is contained in:
parent
dab29e7267
commit
d7367bcb8b
4 changed files with 49 additions and 13 deletions
24
webhook.go
24
webhook.go
|
@ -194,19 +194,19 @@ func main() {
|
|||
err := newHooks.LoadFromFile(hooksFilePath, *asTemplate)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("couldn't load hooks from file! %+v\n", err)
|
||||
} else {
|
||||
log.Printf("found %d hook(s) in file\n", len(newHooks))
|
||||
|
||||
for _, hook := range newHooks {
|
||||
if matchLoadedHook(hook.ID) != nil {
|
||||
log.Fatalf("error: hook with the id %s has already been loaded!\nplease check your hooks file for duplicate hooks ids!\n", hook.ID)
|
||||
}
|
||||
log.Printf("\tloaded: %s\n", hook.ID)
|
||||
}
|
||||
|
||||
loadedHooksFromFiles[hooksFilePath] = newHooks
|
||||
log.Fatalf("couldn't load hooks from file! %+v\n", err)
|
||||
}
|
||||
|
||||
log.Printf("found %d hook(s) in file\n", len(newHooks))
|
||||
|
||||
for _, hook := range newHooks {
|
||||
if matchLoadedHook(hook.ID) != nil {
|
||||
log.Fatalf("error: hook with the id %s has already been loaded!\nplease check your hooks file for duplicate hooks ids!\n", hook.ID)
|
||||
}
|
||||
log.Printf("\tloaded: %s\n", hook.ID)
|
||||
}
|
||||
|
||||
loadedHooksFromFiles[hooksFilePath] = newHooks
|
||||
}
|
||||
|
||||
newHooksFiles := hooksFiles[:0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue