mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-15 14:40:13 +01:00
refactor: extract types and pkgs to new files
This commit is contained in:
parent
4a92a03f31
commit
e109a7a6ce
15 changed files with 71 additions and 57 deletions
|
|
@ -1,19 +1,17 @@
|
|||
package notifications
|
||||
|
||||
import (
|
||||
ty "github.com/containrrr/watchtower/pkg/types"
|
||||
"github.com/johntdyer/slackrus"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type typeNotifier interface {
|
||||
StartNotification()
|
||||
SendNotification()
|
||||
}
|
||||
|
||||
|
||||
// Notifier can send log output as notification to admins, with optional batching.
|
||||
type Notifier struct {
|
||||
types []typeNotifier
|
||||
types []ty.Notifier
|
||||
}
|
||||
|
||||
// NewNotifier creates and returns a new Notifier, using global configuration.
|
||||
|
|
@ -34,7 +32,7 @@ func NewNotifier(c *cobra.Command) *Notifier {
|
|||
types, _ := f.GetStringSlice("notifications")
|
||||
|
||||
for _, t := range types {
|
||||
var tn typeNotifier
|
||||
var tn ty.Notifier
|
||||
switch t {
|
||||
case emailType:
|
||||
tn = newEmailNotifier(c, acceptedLogLevels)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue