preparations for soft deprecation of legacy notification args (#1377)

Co-authored-by: Simon Aronsson <simme@arcticbit.se>
This commit is contained in:
nils måsén 2022-11-01 00:00:00 +01:00 committed by GitHub
parent 2102a056de
commit cb555f539d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 505 additions and 167 deletions

View file

@ -19,11 +19,10 @@ type gotifyTypeNotifier struct {
gotifyURL string
gotifyAppToken string
gotifyInsecureSkipVerify bool
logLevels []log.Level
}
func newGotifyNotifier(c *cobra.Command, levels []log.Level) t.ConvertibleNotifier {
flags := c.PersistentFlags()
func newGotifyNotifier(c *cobra.Command) t.ConvertibleNotifier {
flags := c.Flags()
apiURL := getGotifyURL(flags)
token := getGotifyToken(flags)
@ -34,7 +33,6 @@ func newGotifyNotifier(c *cobra.Command, levels []log.Level) t.ConvertibleNotifi
gotifyURL: apiURL,
gotifyAppToken: token,
gotifyInsecureSkipVerify: skipVerify,
logLevels: levels,
}
return n
@ -62,7 +60,7 @@ func getGotifyURL(flags *pflag.FlagSet) string {
return gotifyURL
}
func (n *gotifyTypeNotifier) GetURL(c *cobra.Command, title string) (string, error) {
func (n *gotifyTypeNotifier) GetURL(c *cobra.Command) (string, error) {
apiURL, err := url.Parse(n.gotifyURL)
if err != nil {
return "", err
@ -72,7 +70,6 @@ func (n *gotifyTypeNotifier) GetURL(c *cobra.Command, title string) (string, err
Host: apiURL.Host,
Path: apiURL.Path,
DisableTLS: apiURL.Scheme == "http",
Title: title,
Token: n.gotifyAppToken,
}