-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
29 lines (25 loc) · 744 Bytes
/
main.go
File metadata and controls
29 lines (25 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"flag"
"fmt"
"log"
"net/http"
)
// CommandPath is the path to the command executed upon each plex webhook event
var (
CommandPath string
CommandTimeout uint
)
func main() {
// command line options
listen := flag.String("listen", "127.0.0.1", "address to listen on")
port := flag.String("port", "8080", "port to listen on")
command := flag.String("command", "./event.sh", "path to the command that is execd upon each event")
timeout := flag.Uint("timeout", 5, "amount of time in seconds to allow the command to run")
flag.Parse()
address := fmt.Sprintf("%s:%s", *listen, *port)
router := NewRouter()
CommandPath = *command
CommandTimeout = *timeout
log.Fatal(http.ListenAndServe(address, router))
}