forked from an/flokati
read webhooks from file
This commit is contained in:
parent
66c4eecfda
commit
4e186fe2b2
|
@ -8,6 +8,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.dnix.de/an/xlog"
|
"git.dnix.de/an/xlog"
|
||||||
|
@ -25,7 +26,12 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func webhookRun() {
|
func webhookRun() {
|
||||||
scanner := bufio.NewScanner(*webhookToken)
|
file, err := os.Open(*webhookToken)
|
||||||
|
if err != nil {
|
||||||
|
xlog.Fatal(err.Error())
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
scanner := bufio.NewScanner(file)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
tok := strings.Split(scanner.Text(), " ")
|
tok := strings.Split(scanner.Text(), " ")
|
||||||
http.HandleFunc("/webhook/"+tok[0], webhookHandleHTTP)
|
http.HandleFunc("/webhook/"+tok[0], webhookHandleHTTP)
|
||||||
|
|
Loading…
Reference in New Issue