-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
280 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/favonia/cloudflare-ddns/internal/notifier" | ||
"github.com/favonia/cloudflare-ddns/internal/pp" | ||
) | ||
|
||
// ReadAndAppendShoutrrrURL reads the URLs separated by the newline. | ||
func ReadAndAppendShoutrrrURL(ppfmt pp.PP, key string, field *[]notifier.Notifier) bool { | ||
vals := Getenvs(key) | ||
|
||
if len(vals) == 0 { | ||
return true | ||
} | ||
|
||
s, ok := notifier.NewShoutrrr(ppfmt, vals) | ||
if !ok { | ||
return false | ||
} | ||
|
||
// Append the new monitor to the existing list | ||
*field = append(*field, s) | ||
return true | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Package notifier implements push notifications. | ||
package notifier | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/favonia/cloudflare-ddns/internal/pp" | ||
) | ||
|
||
//go:generate mockgen -typed -destination=../mocks/mock_notifier.go -package=mocks . Notifier | ||
|
||
// Notifier is an abstract service for push notifications. | ||
type Notifier interface { | ||
// Describe a notifier in a human-readable format by calling callback with service names and params. | ||
Describe(callback func(service, params string)) | ||
|
||
// Send out a message. | ||
Send(ctx context.Context, ppfmt pp.PP, msg string) | ||
} |
Oops, something went wrong.