Documentation
¶
Overview ¶
@index HTTP webhook intake for repository sync dispatch.
Index ¶
- type SyncFunc
- type WebhookHandler
- func NewWebhookHandler(secret []byte, filter *reposync.RepoFilter, onSync SyncFunc) *WebhookHandler
- func NewWebhookHandlerWithConfig(cfg WebhookHandlerConfig) *WebhookHandler
- func NewWebhookHandlerWithOptions(secret []byte, filter *reposync.RepoFilter, onSync SyncFunc, insecure bool) *WebhookHandler
- type WebhookHandlerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SyncFunc ¶
@intent define the callback signature webhook intake invokes to trigger repository sync.
type WebhookHandler ¶
type WebhookHandler struct {
// contains filtered or unexported fields
}
@intent bundle webhook validation policy and dispatch dependencies into one reusable HTTP handler.
func NewWebhookHandler ¶
func NewWebhookHandler(secret []byte, filter *reposync.RepoFilter, onSync SyncFunc) *WebhookHandler
NewWebhookHandler wires a webhook handler from the common secret/filter/sync callback inputs. @intent keep the default construction path small while routing all configuration through the shared config builder. @param secret is the shared webhook secret used for signature validation. @param filter decides which repo and branch combinations are eligible for sync. @param onSync dispatches the validated sync request. @ensures returns a handler configured with the default secure validation path.
func NewWebhookHandlerWithConfig ¶
func NewWebhookHandlerWithConfig(cfg WebhookHandlerConfig) *WebhookHandler
NewWebhookHandlerWithConfig assembles webhook validation and clone URL policy into one handler. @intent make webhook intake configurable without duplicating constructor logic across CLI and tests. @param cfg carries webhook secret, filtering, sync callback, and clone URL policy. @ensures returns a handler whose clone base URLs preserve config ordering with CloneBaseURL first when provided.
func NewWebhookHandlerWithOptions ¶
func NewWebhookHandlerWithOptions(secret []byte, filter *reposync.RepoFilter, onSync SyncFunc, insecure bool) *WebhookHandler
NewWebhookHandlerWithOptions builds a handler with the legacy option-style constructor. @intent preserve older call sites while the config-based constructor owns the actual assembly logic. @param insecure allows payload delivery without signature validation when true. @ensures returns a handler configured equivalently to the legacy constructor inputs.
func (*WebhookHandler) ServeHTTP ¶
func (h *WebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP validates a webhook push event and dispatches repository sync when it passes policy checks. @intent turn GitHub or Gitea push deliveries into safe, filtered sync requests for the build pipeline. @sideEffect reads the request body and invokes the configured sync callback. @domainRule only signed push events for allowed repository/branch pairs are dispatched. @ensures writes an HTTP status describing acceptance, rejection, or sync backpressure for the delivery.
type WebhookHandlerConfig ¶
type WebhookHandlerConfig struct {
Secret []byte
Filter *reposync.RepoFilter
OnSync SyncFunc
Insecure bool
CloneBaseURL string
CloneBaseURLs []string
}
@intent carry all constructor options for webhook validation, clone URL policy, and sync dispatch.