Documentation
¶
Index ¶
- func ParseTimeout(s string) time.Duration
- type BarkConfig
- type Channel
- type ChannelsConfig
- type CoolPushConfig
- type DingTalkConfig
- type Dispatcher
- type Item
- type Kind
- type Message
- type PushPlusConfig
- type Report
- func (r *Report) AddFailure(account, task string, err error)
- func (r *Report) AddFailureMsg(account, task, message string)
- func (r *Report) AddSkip(account, task, reason string)
- func (r *Report) Counts() (failures, skips int)
- func (r *Report) Items() []Item
- func (r *Report) NeedNotify(onSkip bool) bool
- func (r *Report) SetCommand(command string)
- func (r *Report) Summary(titlePrefix string, onSkip bool) (title, content string)
- type ServerChanConfig
- type TelegramConfig
- type WeComAppConfig
- type WeComKeyConfig
- type WebhookConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseTimeout ¶
ParseTimeout parses a duration string with default 10s.
Types ¶
type BarkConfig ¶
type BarkConfig struct {
Enabled bool `yaml:"enabled"`
Key string `yaml:"key"`
Server string `yaml:"server"` // empty => https://api.day.app
}
type ChannelsConfig ¶
type ChannelsConfig struct {
Webhook WebhookConfig `yaml:"webhook"`
Bark BarkConfig `yaml:"bark"`
ServerChan ServerChanConfig `yaml:"serverchan"`
Telegram TelegramConfig `yaml:"telegram"`
DingTalk DingTalkConfig `yaml:"dingtalk"`
CoolPush CoolPushConfig `yaml:"coolpush"`
PushPlus PushPlusConfig `yaml:"pushplus"`
WeComKey WeComKeyConfig `yaml:"wecom_key"`
WeComApp WeComAppConfig `yaml:"wecom_app"`
}
ChannelsConfig is the content of notify.yaml (channel credentials only).
func LoadChannels ¶
func LoadChannels(path string) (cfg *ChannelsConfig, fileMissing bool, err error)
LoadChannels reads notify.yaml and applies environment variable overrides. If the file does not exist, returns an empty config with env overrides only (fileMissing=true). Parse errors still return an error.
type CoolPushConfig ¶
type DingTalkConfig ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher fans out to all enabled channels.
func NewDispatcher ¶
func NewDispatcher(cfg *ChannelsConfig, timeout time.Duration) *Dispatcher
NewDispatcher builds a dispatcher from channel config.
type PushPlusConfig ¶
type Report ¶
Report collects failures/skips for end-of-run summary notification.
func (*Report) AddFailure ¶
AddFailure records a task/account failure.
func (*Report) AddFailureMsg ¶
AddFailureMsg records a failure with a plain message.
func (*Report) NeedNotify ¶
NeedNotify reports whether a push should be sent. Success never notifies. Failures always notify when present. Skips notify only when onSkip is true.
func (*Report) SetCommand ¶
SetCommand sets the command name shown in the summary.