Documentation
¶
Overview ¶
Package daemon provides methods for implementing a long-running daemon to listen for and process webhooks.
Index ¶
- type WebhookDaemon
- func (d *WebhookDaemon) AddWebhook(ctx context.Context, wh webhook.Webhook) error
- func (d *WebhookDaemon) AddWebhooksFromConfig(ctx context.Context, cfg *config.WebhookConfig) error
- func (d *WebhookDaemon) HandlerFunc() (http.HandlerFunc, error)
- func (d *WebhookDaemon) HandlerFuncWithLogger(logger *log.Logger) (http.HandlerFunc, error)
- func (d *WebhookDaemon) Start(ctx context.Context) error
- func (d *WebhookDaemon) StartWithLogger(ctx context.Context, logger *log.Logger) error
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 ¶
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
StartWithLogger() causes 'd' to listen for, and process, requests logging events to 'logger'.