mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-15 14:40:13 +01:00
switch urfave to cobra
This commit is contained in:
parent
339df55cc6
commit
998e8052c5
10 changed files with 581 additions and 398 deletions
|
|
@ -4,10 +4,10 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"net/http"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
|
|
@ -21,17 +21,20 @@ type msTeamsTypeNotifier struct {
|
|||
data bool
|
||||
}
|
||||
|
||||
func newMsTeamsNotifier(c *cli.Context, acceptedLogLevels []log.Level) typeNotifier {
|
||||
func newMsTeamsNotifier(cmd *cobra.Command, acceptedLogLevels []log.Level) typeNotifier {
|
||||
|
||||
webHookURL := c.GlobalString("notification-msteams-hook")
|
||||
flags := cmd.PersistentFlags()
|
||||
|
||||
webHookURL, _ := flags.GetString("notification-msteams-hook")
|
||||
if len(webHookURL) <= 0 {
|
||||
log.Fatal("Required argument --notification-msteams-hook(cli) or WATCHTOWER_NOTIFICATION_MSTEAMS_HOOK_URL(env) is empty.")
|
||||
}
|
||||
|
||||
withData, _ := flags.GetBool("notification-msteams-data")
|
||||
n := &msTeamsTypeNotifier{
|
||||
levels: acceptedLogLevels,
|
||||
webHookURL: webHookURL,
|
||||
data: c.GlobalBool("notification-msteams-data"),
|
||||
data: withData,
|
||||
}
|
||||
|
||||
log.AddHook(n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue