[skip ci] gofmt

master
Simon Bruder 2019-06-17 12:28:01 +00:00
parent 09c4d66797
commit f33dc4d866
No known key found for this signature in database
GPG Key ID: 6F03E0000CC5B62F
1 changed files with 8 additions and 8 deletions

View File

@ -1,12 +1,12 @@
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"encoding/json"
"io/ioutil"
"strings"
"github.com/gotify/go-api-client/auth"
@ -21,13 +21,13 @@ type POSTData struct {
type Alert struct {
Annotations Annotations `json:annotations`
Labels Labels `json:labels`
Status string `json:status`
Labels Labels `json:labels`
Status string `json:status`
}
type Annotations struct {
Description string `json:description`
Title string `json:title`
Title string `json:title`
}
type Labels struct {
@ -37,7 +37,7 @@ type Labels struct {
func main() {
gotifyURL := os.Getenv("GOTIFY_URL")
http.HandleFunc("/alert", func (w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/alert", func(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
http.Error(w, "405 Method not allowed", http.StatusMethodNotAllowed)
return
@ -80,8 +80,8 @@ func main() {
params := message.NewCreateMessageParams()
params.Body = &models.MessageExternal{
Title: title.String(),
Message: alert.Annotations.Description,
Title: title.String(),
Message: alert.Annotations.Description,
}
_, err = client.Message.CreateMessage(params, auth.TokenAuth(applicationToken))