webhook

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package webhook implements notifier.Provider as an HTTP POST to a configured URL. The body is the JSON-encoded notifier.Notification; when Token is set, the request carries "Authorization: Bearer <token>" so the receiver can identify the calling host. Format and rotation of the token live entirely on the receiver side — this Provider treats it as an opaque string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider POSTs Notifications to URL. Construct with New.

func New

func New(url, token string, lg *log.Logger) *Provider

New constructs a Provider. A nil logger uses a stderr-prefixed default. Empty token sends unauthenticated requests — fine for dev against a local sink, never for production.

func (*Provider) Close

func (p *Provider) Close(_ context.Context) error

Close is a no-op — net/http connection pooling cleans up automatically when the client is garbage-collected.

func (*Provider) Send

Send POSTs n as JSON. On 5xx or network error it retries once after retryDelay; 4xx is non-retryable and returns immediately. No DLQ — the Loop owns the lifecycle and we don't try to outsmart it.

Jump to

Keyboard shortcuts

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