daemon

package
v3.3.6 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: BSD-3-Clause Imports: 17 Imported by: 5

Documentation

Overview

Package daemon provides methods for implementing a long-running daemon to listen for and process webhooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebhookDaemon

type WebhookDaemon struct {

	// AllowDebug is a boolean flag to enable debugging reporting in webhook responses.
	AllowDebug bool
	// contains filtered or unexported fields
}

type WebhookDaemon is a struct that implements a long-running daemon to listen for and process webhooks.

func NewWebhookDaemon

func NewWebhookDaemon(ctx context.Context, uri string) (*WebhookDaemon, error)

NewWebhookDaemon() returns a `WebhookDaemon` instance derived from 'uri' which is expected to take the form of any valid `aaronland/go-http-server.Server` URI with the following parameters: * `?allow_debug=` An optional boolean flag to enable debugging output in webhook responses.

func NewWebhookDaemonFromConfig

func NewWebhookDaemonFromConfig(ctx context.Context, cfg *config.WebhookConfig) (*WebhookDaemon, error)

NewWebhookDaemonFromConfig() returns a new `WebhookDaemon` derived from configuration data in 'cfg'.

func (*WebhookDaemon) AddWebhook

func (d *WebhookDaemon) AddWebhook(ctx context.Context, wh webhook.Webhook) error

AddWebhook() adds 'wh' to 'd'.

func (*WebhookDaemon) AddWebhooksFromConfig

func (d *WebhookDaemon) AddWebhooksFromConfig(ctx context.Context, cfg *config.WebhookConfig) error

AddWebhooksFromConfig() appends the webhooks defined in 'cfg' to 'd'.

func (*WebhookDaemon) HandlerFunc

func (d *WebhookDaemon) HandlerFunc() (http.HandlerFunc, error)

HandlerFunc() returns a `http.HandlerFunc` that handles HTTP (webhook) requests and response for 'd'.

func (*WebhookDaemon) HandlerFuncWithLogger added in v3.1.0

func (d *WebhookDaemon) HandlerFuncWithLogger(logger *log.Logger) (http.HandlerFunc, error)

HandlerFuncWithLogger() returns a `http.HandlerFunc` that handles HTTP (webhook) requests and response for 'd' logging events to 'logger'.

func (*WebhookDaemon) Start

func (d *WebhookDaemon) Start(ctx context.Context) error

Start() causes 'd' to listen for, and process, requests.

func (*WebhookDaemon) StartWithLogger added in v3.1.0

func (d *WebhookDaemon) StartWithLogger(ctx context.Context, logger *log.Logger) error

StartWithLogger() causes 'd' to listen for, and process, requests logging events to 'logger'.

Jump to

Keyboard shortcuts

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