mirror of
https://framagit.org/fredix/drone-gotify
synced 2026-01-23 02:14:06 +00:00
24 lines
535 B
Go
24 lines
535 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"net/url"
|
|
"os"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
token := os.Getenv("PLUGIN_GOTIFYTOKEN")
|
|
endpoint := os.Getenv("PLUGIN_GOTIFYENDPOINT")
|
|
title := os.Getenv("PLUGIN_GOTIFYTITLE")
|
|
message := os.Getenv("message")
|
|
priority := os.Getenv("PLUGIN_GOTIFYPRIORITY")
|
|
|
|
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)
|
|
}
|
|
}
|