示例#1
0
func newServer(q conveyor.BuildQueue, c *cli.Context) http.Handler {
	r := mux.NewRouter()

	// Github webhooks
	r.MatcherFunc(githubWebhook).Handler(
		hookshot.Authorize(
			conveyor.NewServer(q),
			c.String("github.secret"),
		),
	)

	// Slack webhooks
	if c.String("slack.token") != "" {
		r.Handle("/slack", newSlackServer(c))
	}

	n := negroni.Classic()
	n.UseHandler(r)

	return n
}
示例#2
0
func newServer(q conveyor.BuildQueue, c *cli.Context) http.Handler {
	return hookshot.Authorize(
		conveyor.NewServer(q),
		c.String("github.secret"),
	)
}