register log hook with router

pull/1/head
Brad Rydzewski 5 years ago
parent 7c8c033936
commit 711aa61628

@ -9,6 +9,7 @@ import (
"github.com/drone/runner-go/handler"
"github.com/drone/runner-go/handler/static"
hook "github.com/drone/runner-go/logger/history"
"github.com/drone/runner-go/pipeline/history"
"github.com/99designs/basicauth-go"
@ -22,7 +23,7 @@ type Config struct {
}
// New returns a new route handler.
func New(tracer *history.History, config Config) http.Handler {
func New(tracer *history.History, history *hook.Hook, config Config) http.Handler {
// middleware to require basic authentication.
auth := basicauth.New(config.Realm, map[string][]string{
config.Username: {config.Password},
@ -34,6 +35,7 @@ func New(tracer *history.History, config Config) http.Handler {
mux := http.NewServeMux()
mux.Handle("/static/", http.StripPrefix("/static/", fs))
mux.HandleFunc("/healthz", handler.HandleHealth(tracer))
mux.Handle("/logs", auth(handler.HandleLogHistory(history)))
mux.Handle("/", auth(handler.HandleIndex(tracer)))
return mux
}

Loading…
Cancel
Save