notify

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notify sends a periodic e-mail digest of open tasks over SMTP. It is deliberately small: STARTTLS submission (port 587) via the standard library, a plain-text body built from the metadata index, and a background ticker. Disabled unless VELLUM_NOTIFY=on and SMTP settings are present.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digest

func Digest(ix Tasks, publicURL string) (subject, body string, count int)

Digest builds the subject, plain-text body and open-task count.

Types

type Config

type Config struct {
	Enabled   bool
	Host      string
	Port      string
	User      string
	Pass      string
	From      string
	To        []string
	Interval  time.Duration
	PublicURL string
}

Config holds SMTP settings and the digest cadence.

func FromEnv

func FromEnv(publicURL string) Config

FromEnv reads the SMTP configuration from the environment.

func (Config) Valid

func (c Config) Valid() bool

Valid reports whether enough is set to actually send mail.

type Mailer

type Mailer interface {
	Send(subject, body string) error
}

Mailer sends one message. Abstracted so the digest logic is testable.

type Notifier

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

Notifier runs the periodic digest.

func New

func New(cfg Config, tasks Tasks, log *slog.Logger) *Notifier

New builds a Notifier that mails via SMTP using cfg.

func (*Notifier) Loop

func (n *Notifier) Loop(ctx context.Context)

Loop sends a digest shortly after boot (to confirm the setup) and then every cfg.Interval until ctx is cancelled.

func (*Notifier) SendDigest

func (n *Notifier) SendDigest()

SendDigest builds and sends one digest now.

type Tasks

type Tasks interface {
	ListTasks(status, project string) []vault.Entry
}

Tasks is the slice of the index the digest needs.

Jump to

Keyboard shortcuts

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