drone-gotify/drone-gotify.go
2019-06-09 14:52:41 +02:00

24 lines
518 B
Go

package main
import (
"net/http"
"net/url"
"os"
"log"
)
func main() {
token := os.Getenv("PLUGIN_TOKEN")
endpoint := os.Getenv("PLUGIN_ENDPOINT")
title := os.Getenv("PLUGIN_TITLE")
message := os.Getenv("PLUGIN_MESSAGE")
priority := os.Getenv("PLUGIN_PRIORITY")
resp, err := http.PostForm(endpoint + "/message?token=" + token, url.Values{"message": {message}, "title": {title}, "priority": {priority}})
if resp != nil {
resp.Body.Close()
}
if err != nil {
log.Fatalln(err)
}
}