X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/442a871e7f3476938d0ebb3adbe3b9a7742f03ad..c44aa637f62f4f0943172ccdcc3e3031c5b838c0:/lib/controller/handler.go diff --git a/lib/controller/handler.go b/lib/controller/handler.go index 2c3ce1d4f2..01f2161632 100644 --- a/lib/controller/handler.go +++ b/lib/controller/handler.go @@ -15,9 +15,12 @@ import ( "sync" "time" - "git.curoverse.com/arvados.git/sdk/go/arvados" - "git.curoverse.com/arvados.git/sdk/go/health" - "git.curoverse.com/arvados.git/sdk/go/httpserver" + "git.arvados.org/arvados.git/lib/controller/federation" + "git.arvados.org/arvados.git/lib/controller/railsproxy" + "git.arvados.org/arvados.git/lib/controller/router" + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/health" + "git.arvados.org/arvados.git/sdk/go/httpserver" _ "github.com/lib/pq" ) @@ -60,10 +63,14 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (h *Handler) CheckHealth() error { h.setupOnce.Do(h.setup) - _, _, err := findRailsAPI(h.Cluster) + _, _, err := railsproxy.FindRailsAPI(h.Cluster) return err } +func (h *Handler) Done() <-chan struct{} { + return nil +} + func neverRedirect(*http.Request, []*http.Request) error { return http.ErrUseLastResponse } func (h *Handler) setup() { @@ -73,6 +80,20 @@ func (h *Handler) setup() { Prefix: "/_health/", Routes: health.Routes{"ping": func() error { _, err := h.db(&http.Request{}); return err }}, }) + + rtr := router.New(federation.New(h.Cluster)) + mux.Handle("/arvados/v1/config", rtr) + mux.Handle("/"+arvados.EndpointUserAuthenticate.Path, rtr) + + if !h.Cluster.ForceLegacyAPI14 { + mux.Handle("/arvados/v1/collections", rtr) + mux.Handle("/arvados/v1/collections/", rtr) + mux.Handle("/arvados/v1/users", rtr) + mux.Handle("/arvados/v1/users/", rtr) + mux.Handle("/login", rtr) + mux.Handle("/logout", rtr) + } + hs := http.NotFoundHandler() hs = prepend(hs, h.proxyRailsAPI) hs = h.setupProxyRemoteCluster(hs) @@ -126,7 +147,7 @@ func prepend(next http.Handler, middleware middlewareFunc) http.Handler { } func (h *Handler) localClusterRequest(req *http.Request) (*http.Response, error) { - urlOut, insecure, err := findRailsAPI(h.Cluster) + urlOut, insecure, err := railsproxy.FindRailsAPI(h.Cluster) if err != nil { return nil, err }