mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-07 21:47:09 +00:00

- 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
30 lines
646 B
Go
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))
|
|
}
|