File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,25 @@ type discordEmbedField struct {
67
67
Value string `json:"value"`
68
68
}
69
69
70
+ const defaultListenAddress = "127.0.0.1:9094"
71
+
70
72
func main () {
71
73
envWhURL := os .Getenv ("DISCORD_WEBHOOK" )
72
74
whURL := flag .String ("webhook.url" , envWhURL , "Discord WebHook URL." )
73
- listenAddress := flag .String ("listen.address" , "127.0.0.1:9094" , "Address:Port to listen on." )
75
+
76
+ envListenAddress := os .Getenv ("LISTEN_ADDRESS" )
77
+ listenAddress := flag .String ("listen.address" , envListenAddress , "Address:Port to listen on." )
78
+
74
79
flag .Parse ()
75
80
76
81
if * whURL == "" {
77
82
log .Fatalf ("Environment variable 'DISCORD_WEBHOOK' or CLI parameter 'webhook.url' not found." )
78
83
}
79
84
85
+ if * listenAddress == "" {
86
+ * listenAddress = defaultListenAddress
87
+ }
88
+
80
89
re := regexp .MustCompile (`https://discord(?:app)?.com/api/webhooks/[0-9]{18}/[a-zA-Z0-9_-]+` )
81
90
if ok := re .Match ([]byte (* whURL )); ! ok {
82
91
log .Fatalf ("The Discord WebHook URL doesn't seem to be valid." )
You can’t perform that action at this time.
0 commit comments