webhook

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package webhook hosts the HTTP server that ingests provider webhooks and dispatches them to the workflow runtime via workflow.Callback. See DESIGN.md § "Architecture".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher func(ctx context.Context, runID string, event provider.Event) error

Dispatcher receives normalised events bound for a specific runID. In production this is a thin wrapper that calls workflow.Callback.

type SecretRegistry

type SecretRegistry struct {
	// contains filtered or unexported fields
}

SecretRegistry maps a (provider, runID) to the HMAC secret we registered with that provider's webhook. Per-Run secrets so a leaked one only affects one Run.

func NewSecretRegistry

func NewSecretRegistry() *SecretRegistry

func (*SecretRegistry) Forget

func (r *SecretRegistry) Forget(providerName, runID string)

func (*SecretRegistry) Get

func (r *SecretRegistry) Get(providerName, runID string) (string, bool)

func (*SecretRegistry) Set

func (r *SecretRegistry) Set(providerName, runID, secret string)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP front for webhook ingestion. Mount it onto an http.ServeMux via Mount(); the daemon owns the http.Server lifecycle.

Routing: POST /webhook/{providerName}/{runID}

  • Looks up the registered runID + secret
  • Verifies HMAC via the provider
  • Normalises the event
  • Calls the registered Dispatcher

func NewServer

func NewServer(providers map[string]provider.Provider, dispatcher Dispatcher, secrets *SecretRegistry) *Server

NewServer wires a Server. providers maps name → Provider impl.

func (*Server) Mount

func (s *Server) Mount(mux *http.ServeMux)

Mount registers the webhook server's routes (/webhook/{provider}/{runID} and /health) on the provided mux. The caller owns the http.Server. This lets the daemon mount other routes (e.g. /trigger on a separate listener) without webhook-coupling its lifecycle.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL