feat: added Init() and Cleanup() in hooks

This commit is contained in:
David Allen 2025-08-31 22:04:02 -06:00
parent bdd85b01ff
commit 277de43a02
Signed by: towk
GPG key ID: 0430CDBE22619155
2 changed files with 24 additions and 0 deletions

View file

@ -142,6 +142,14 @@ func (s *Service) Download() http.HandlerFunc {
"version": hook.Plugin.Version(),
},
}).Send()
err = hook.Init()
if err != nil {
log.Error().
Err(err).
Str("plugin", hook.Plugin.Name()).
Msg("failed to initialize plugin")
continue
}
err = hook.Run()
if err != nil {
log.Error().
@ -150,6 +158,14 @@ func (s *Service) Download() http.HandlerFunc {
Msg("failed to run plugin")
continue
}
err = hook.Cleanup()
if err != nil {
log.Error().
Err(err).
Str("plugin", hook.Plugin.Name()).
Msg("failed to cleanup plugin")
continue
}
}
// take the contents from the last hook and update files