Skip to content

Commit 45ea6ee

Browse files
committed
Allow compatibility with the flag for the webhook
1 parent 85ff16f commit 45ea6ee

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ type discordOut struct {
4848

4949
func main() {
5050
webhookUrl := os.Getenv("DISCORD_WEBHOOK")
51-
if webhookUrl == "" {
51+
whURL := flag.String("webhook.url", webhookUrl, "")
52+
flag.Parse()
53+
54+
if webhookUrl == "" && *whURL == "" {
5255
fmt.Fprintf(os.Stderr, "error: environment variable DISCORD_WEBHOOK not found\n")
5356
os.Exit(1)
5457
}
55-
whURL := flag.String("webhook.url", webhookUrl, "")
56-
flag.Parse()
58+
5759
fmt.Fprintf(os.Stdout, "info: Listening on 0.0.0.0:9094\n")
5860
http.ListenAndServe(":9094", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
5961
b, err := ioutil.ReadAll(r.Body)

0 commit comments

Comments
 (0)