webhookd/main.go
Nicolas Carlier 14c214efdf refactor(): Complete refactoring.
- No external dependencies
- No predefined directory structure
- Able to launch any kind of shell script with custom parameters
- Get script output as text event stream (SSE)
- Using common Makefiles
- Extends docker/dind Docker image
2018-01-02 16:11:59 +00:00

30 lines
646 B
Go

package main
import (
"flag"
"log"
"net/http"
"github.com/ncarlier/webhookd/pkg/api"
"github.com/ncarlier/webhookd/pkg/worker"
)
var (
lAddr = flag.String("l", ":8080", "HTTP service address (e.g.address, ':8080')")
nbWorkers = flag.Int("n", 2, "The number of workers to start")
)
func main() {
flag.Parse()
log.Println("Starting webhookd server...")
// Start the dispatcher.
log.Printf("Starting the dispatcher (%d workers)...\n", *nbWorkers)
worker.StartDispatcher(*nbWorkers)
log.Printf("Starting the http server (%s)\n", *lAddr)
http.HandleFunc("/", api.WebhookHandler)
log.Fatal(http.ListenAndServe(*lAddr, nil))
}