notify

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Overview

Package notify is keryx's pluggable alert seam (spec 0010 §6): a Notifier interface with config-selected backends (none, webhook, …). `auth refresh` uses it to surface impending-expiry / refresh-failure alerts; a non-zero exit is the always-on baseline regardless of backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	Host     string
	Port     int
	Username string
	Password string
	From     string
	To       []string
	// contains filtered or unexported fields
}

Email sends alerts over SMTP. host/port/from/to come from config; the credentials come from the environment (ALERT_SMTP_USERNAME / ALERT_SMTP_PASSWORD), falling back to config for headless setups.

func (Email) Notify

func (e Email) Notify(ctx context.Context, msg string) error

Notify sends the message as a plain-text email to the configured recipients.

type None

type None struct{}

None drops alerts — the caller still exits non-zero (red pipeline). Default.

func (None) Notify

func (None) Notify(context.Context, string) error

Notify is a no-op.

type Notifier

type Notifier interface {
	Notify(ctx context.Context, msg string) error
}

Notifier delivers an alert message to a configured destination.

func New

func New(cfg config.Reader) (Notifier, error)

New builds the configured notifier (auth.alerts.backend: none | webhook | email).

type Webhook

type Webhook struct {
	URL  string
	HTTP *http.Client
}

Webhook POSTs {"text": msg} to a Slack/Teams-style incoming webhook.

func (Webhook) Notify

func (w Webhook) Notify(ctx context.Context, msg string) error

Notify posts the message to the webhook URL.

Jump to

Keyboard shortcuts

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