mirror of
https://github.com/Theodor-Springmann-Stiftung/lenz-web.git
synced 2025-10-29 01:05:32 +00:00
GitHub Webhooks integration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/Theodor-Springmann-Stiftung/lenz-web/config"
|
||||
"github.com/Theodor-Springmann-Stiftung/lenz-web/helpers/middleware"
|
||||
"github.com/Theodor-Springmann-Stiftung/lenz-web/server"
|
||||
"github.com/Theodor-Springmann-Stiftung/lenz-web/views"
|
||||
@@ -9,11 +10,21 @@ import (
|
||||
)
|
||||
|
||||
const ASSETS_URL = "/assets"
|
||||
const WBHOOK_URL = "/webhook"
|
||||
|
||||
func Register(server server.Server) {
|
||||
func Register(server server.Server, cfg config.Config) {
|
||||
server.Server.Use(ASSETS_URL, compress.New(compress.Config{
|
||||
Level: compress.LevelBestSpeed,
|
||||
}))
|
||||
server.Server.Use(ASSETS_URL, middleware.StaticHandler(&views.StaticFS))
|
||||
server.Server.Get("/", GetIndex)
|
||||
|
||||
if cfg.WebHookSecret != "" {
|
||||
whurl := WBHOOK_URL
|
||||
if cfg.WebHookEndpoint != "" {
|
||||
whurl = cfg.WebHookEndpoint
|
||||
}
|
||||
server.Server.Post(whurl, PostWebhook(cfg))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user