Documentation
¶
Overview ¶
Package notify is FlatRun's core notification service. It stores delivery targets (email, webhook, chat, ... as shoutrrr URLs), routes events to the enabled ones, and can send a test message. It is a core capability: plugins emit events and the core delivers them, so notification configuration lives in one place rather than per plugin.
Index ¶
Constants ¶
const MaskedURL = "********"
MaskedURL stands in for a target URL in API responses. A shoutrrr URL carries its credentials inline (an SMTP password, a webhook token), so the real URL is never returned to a client; it is written verbatim only to the on-disk store.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Targets []Target `yaml:"targets" json:"targets"`
}
Config is the persisted notification settings.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service loads/saves targets and delivers messages.
func NewService ¶
func (*Service) Notify ¶
Notify delivers title + message to every enabled target. It returns the first delivery error, if any, but attempts all targets.
func (*Service) NotifyTargets ¶
NotifyTargets delivers to a chosen subset of targets by id. An empty list means every enabled target, which is what plain Notify does.
type Target ¶
type Target struct {
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
URL string `yaml:"url" json:"url"`
Enabled bool `yaml:"enabled" json:"enabled"`
}
Target is one delivery destination. URL is a shoutrrr service URL, e.g. "smtp://user:pass@host:587/?from=x&to=y" or "generic+https://example.com/hook".
func (Target) MarshalJSON ¶
MarshalJSON masks the credential-bearing URL. YAML persistence does not use this path, so the stored file keeps the real URL.