forked from an/flokati
read webhooks from file
This commit is contained in:
parent
66c4eecfda
commit
4e186fe2b2
|
@ -8,6 +8,7 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.dnix.de/an/xlog"
|
||||
|
@ -25,7 +26,12 @@ func init() {
|
|||
}
|
||||
|
||||
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() {
|
||||
tok := strings.Split(scanner.Text(), " ")
|
||||
http.HandleFunc("/webhook/"+tok[0], webhookHandleHTTP)
|
||||
|
|
Loading…
Reference in New Issue