package main import ( "encoding/json" "fmt" "log" "net/http" "github.com/gorilla/mux" "hg.lukegb.com/lukegb/depot/go/openshiftauth" ) func main() { r := mux.NewRouter() authR, err := openshiftauth.NewRouter(r) if err != nil { log.Fatalf("openshiftauth.NewRouter: %v", err) } authR.HandleFunc("/", func(rw http.ResponseWriter, r *http.Request) { u := openshiftauth.UserFromContext(r.Context()) rw.Header().Set("Content-Type", "application/json") enc := json.NewEncoder(rw) enc.SetIndent("", " ") enc.Encode(u) }) r.HandleFunc("/healthz", func(rw http.ResponseWriter, r *http.Request) { rw.Header().Set("Content-Type", "text/plain") fmt.Fprintf(rw, "ok") }) http.Handle("/", r) http.ListenAndServe(":8080", nil) }