mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
+Github webhooks
This commit is contained in:
14
app/kgpz.go
14
app/kgpz.go
@@ -188,15 +188,7 @@ func (k *KGPZ) Routes(srv *fiber.App) error {
|
||||
srv.Get(CITATION_URL, controllers.Get(CITATION_URL))
|
||||
|
||||
if k.Config.WebHookSecret != "" && k.Config.WebHookEndpoint != "" {
|
||||
handler, rc := controllers.PostWebhook(k.Config.WebHookSecret)
|
||||
srv.Post(k.Config.WebHookEndpoint, handler)
|
||||
go func() {
|
||||
for signal := range rc {
|
||||
if signal {
|
||||
k.Pull()
|
||||
}
|
||||
}
|
||||
}()
|
||||
srv.Post(k.Config.WebHookEndpoint, controllers.PostWebhook(k))
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -594,6 +586,10 @@ func (k *KGPZ) IsDebug() bool {
|
||||
return k.Config.Debug
|
||||
}
|
||||
|
||||
func (k *KGPZ) GetWebHookSecret() string {
|
||||
return k.Config.WebHookSecret
|
||||
}
|
||||
|
||||
func (k *KGPZ) Pull() {
|
||||
if k.Repo == nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user