notification

package
v5.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SMTPConfig

type SMTPConfig struct {
	Host     string
	Port     int
	Username string
	Password string
	From     string
	AuthType string
}

SMTPConfig holds server-level SMTP configuration from env vars / CLI flags.

func (SMTPConfig) IsConfigured

func (c SMTPConfig) IsConfigured() bool

IsConfigured returns true if the minimum SMTP settings are provided.

type SMTPStatus

type SMTPStatus struct {
	Configured bool   `json:"configured"`
	Host       string `json:"host,omitempty"`
	Port       int    `json:"port,omitempty"`
	From       string `json:"from,omitempty"`
	AuthType   string `json:"auth_type,omitempty"`
}

SMTPStatus is the non-sensitive SMTP info returned to the admin UI.

type Service

type Service interface {
	// Dispatch evaluates notification config and sends email if appropriate.
	Dispatch(ctx context.Context, repo *model.Repo, pipeline *model.Pipeline, previousStatus model.StatusValue) error
	// TestSMTP sends a test email to the configured From address.
	TestSMTP(ctx context.Context) error
	// SMTPStatus returns the non-sensitive SMTP configuration for display.
	SMTPStatus() SMTPStatus
}

Service handles sending pipeline notifications.

func NewService

func NewService(store model.NotificationConfigStore, unsubStore model.EmailUnsubscribeStore, smtpCfg SMTPConfig, serverHost, jwtSecret string, userEmailLookup UserEmailLookup, userIDLookup UserIDLookup) Service

NewService creates a notification service.

type UserEmailLookup added in v5.7.0

type UserEmailLookup func(login string) string

UserEmailLookup resolves a forge login name to the user's configured email. Returns empty string if the user is not found.

type UserIDLookup added in v5.8.0

type UserIDLookup func(login string) int64

UserIDLookup resolves a forge login name to the user's internal ID. Returns 0 if the user is not found.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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