| Index: appengine/cmd/dm/frontend/init.go
|
| diff --git a/appengine/cmd/dm/frontend/init.go b/appengine/cmd/dm/frontend/init.go
|
| index 1a6d0c55fac6d675e28c6721d20f9591a0a6ec44..ca3a81cb2b1796a3865ae4ce685248399cf2ede2 100644
|
| --- a/appengine/cmd/dm/frontend/init.go
|
| +++ b/appengine/cmd/dm/frontend/init.go
|
| @@ -7,9 +7,6 @@ package frontend
|
| import (
|
| "net/http"
|
|
|
| - "golang.org/x/net/context"
|
| -
|
| - "github.com/julienschmidt/httprouter"
|
| "github.com/luci/luci-go/appengine/cmd/dm/deps"
|
| "github.com/luci/luci-go/appengine/gaeconfig"
|
| "github.com/luci/luci-go/appengine/gaemiddleware"
|
| @@ -17,37 +14,38 @@ import (
|
| "github.com/luci/luci-go/common/config"
|
| "github.com/luci/luci-go/common/logging"
|
| "github.com/luci/luci-go/server/discovery"
|
| - "github.com/luci/luci-go/server/middleware"
|
| "github.com/luci/luci-go/server/prpc"
|
| + "github.com/luci/luci-go/server/router"
|
| )
|
|
|
| -func base(h middleware.Handler) httprouter.Handle {
|
| - newH := func(c context.Context, rw http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
| - cfg, err := gaeconfig.New(c)
|
| - switch err {
|
| - case nil:
|
| - c = config.Set(c, cfg)
|
| - case gaeconfig.ErrNotConfigured:
|
| - logging.Warningf(c, "luci-config service url not configured. Configure this at /admin/settings/gaeconfig.")
|
| - default:
|
| - panic(err)
|
| - }
|
| - h(c, rw, r, p)
|
| - }
|
| - return gaemiddleware.BaseProd(newH)
|
| +func base() []router.Handler {
|
| + return append(
|
| + gaemiddleware.BaseProd(),
|
| + func(c *router.Context) {
|
| + cfg, err := gaeconfig.New(c.Context)
|
| + switch err {
|
| + case nil:
|
| + c.Context = config.Set(c.Context, cfg)
|
| + case gaeconfig.ErrNotConfigured:
|
| + logging.Warningf(c.Context, "luci-config service url not configured. Configure this at /admin/settings/gaeconfig.")
|
| + default:
|
| + panic(err)
|
| + }
|
| + },
|
| + )
|
| }
|
|
|
| func init() {
|
| - router := httprouter.New()
|
| + r := router.New()
|
| tmb := tumble.Service{}
|
|
|
| svr := prpc.Server{}
|
| deps.RegisterDepsServer(&svr)
|
| discovery.Enable(&svr)
|
|
|
| - svr.InstallHandlers(router, base)
|
| - tmb.InstallHandlers(router)
|
| - gaemiddleware.InstallHandlers(router, base)
|
| + svr.InstallHandlers(r, base())
|
| + tmb.InstallHandlers(r)
|
| + gaemiddleware.InstallHandlers(r, base())
|
|
|
| - http.Handle("/", router)
|
| + http.Handle("/", r)
|
| }
|
|
|