redelivery

package
v0.0.0-...-1c66ef6 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package redelivery implements a daemon that periodically re-delivers failed GitHub webhook deliveries.

Index

Constants

View Source
const (
	GitHubAppIDEnvVar             = "APP_GITHUB_APP_ID"
	GitHubAppInstallationIDEnvVar = "APP_GITHUB_APP_INSTALLATION_ID"
	GitHubAppPrivateKeyEnvVar     = "APP_GITHUB_APP_PRIVATE_KEY_VALUE"
	GitHubPathEnvVar              = "APP_GITHUB_PATH"
	WebhookIDEnvVar               = "APP_WEBHOOK_ID"
	RedeliveryIntervalEnvVar      = "APP_REDELIVERY_INTERVAL"
)

Environment variable names for redelivery configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// GitHubAppID is the GitHub App ID for app-based authentication.
	GitHubAppID int64

	// GitHubAppInstallationID is the GitHub App installation ID.
	GitHubAppInstallationID int64

	// GitHubAppPrivateKey is the PEM-encoded private key for the GitHub App.
	GitHubAppPrivateKey string

	// GitHubOrg is the GitHub organization where the webhook is registered.
	GitHubOrg string

	// GitHubRepo is the GitHub repository (optional, for repo-level webhooks).
	GitHubRepo string

	// WebhookID is the identifier of the webhook to check deliveries for.
	WebhookID int64

	// Interval is the polling interval between redelivery checks.
	// Defaults to 10 minutes if zero.
	Interval time.Duration
}

Config holds the configuration for the redelivery daemon.

func ConfigFromEnv

func ConfigFromEnv() (*Config, error)

ConfigFromEnv builds a redelivery config from environment variables. Returns nil if redelivery is not configured (missing github path or webhook ID).

func (*Config) Validate

func (c *Config) Validate() error

Validate checks that the config has all required fields.

type Daemon

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

Daemon periodically checks for failed webhook deliveries and re-delivers them.

func NewDaemon

func NewDaemon(cfg *Config) (*Daemon, error)

NewDaemon creates a new redelivery daemon with the given config.

func (*Daemon) Run

func (d *Daemon) Run(ctx context.Context)

Run starts the periodic redelivery loop. It blocks until the context is cancelled.

type GitHubClient

type GitHubClient interface {
	ListDeliveries(ctx context.Context, org, repo string, hookID int64, since time.Time) ([]*github.HookDelivery, error)
	RedeliverDelivery(ctx context.Context, org, repo string, hookID, deliveryID int64) error
}

GitHubClient abstracts GitHub API operations for webhook delivery management.

Jump to

Keyboard shortcuts

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