Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoopNotifier ¶
type NoopNotifier struct{}
NoopNotifier is a Notifier that does nothing, used when Slack notifications are disabled
type Notifier ¶
type Notifier interface {
SendError(ctx context.Context, summary string, err error, details map[string]interface{}) error
}
Notifier represents an interface for a generic notifier
func NewSlackNotifier ¶
func NewSlackNotifier(slackConfig *SlackConfig) Notifier
NewSlackNotifier creates a new SlackNotifier if slack is enabled in the config, otherwise it returns a NoopNotifier
type SlackClient ¶
type SlackClient interface {
PostMessage(channelID string, options ...slack.MsgOption) (string, string, error)
}
SlackClient is an interface to enable mocking of the slack-go/slack.Client
type SlackConfig ¶
type SlackConfig struct {
APIToken string `envconfig:"SLACK_API_TOKEN"`
Username string `envconfig:"SLACK_USERNAME"`
Channel string `envconfig:"SLACK_CHANNEL"`
Emoji string `envconfig:"SLACK_EMOJI"`
Enabled bool `envconfig:"SLACK_ENABLED"`
}
SlackConfig holds configuration for sending Slack notifications
type SlackNotifier ¶
type SlackNotifier struct {
Client SlackClient
Username string
Channel string
Emoji string
}
SlackNotifier is a Notifier that uses slack-go/slack.Client to send notifications
Click to show internal directories.
Click to hide internal directories.