Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: appengine/cmd/logdog_coordinator/backend/main.go

Issue 2043423004: Make HTTP middleware easier to use (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: gaemiddleware: add middleware func for WithProd Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package module 5 package module
6 6
7 import ( 7 import (
8 "net/http" 8 "net/http"
9 9
10 "golang.org/x/net/context" 10 "golang.org/x/net/context"
11 11
12 "github.com/julienschmidt/httprouter"
13 "github.com/luci/luci-go/appengine/logdog/coordinator" 12 "github.com/luci/luci-go/appengine/logdog/coordinator"
14 "github.com/luci/luci-go/appengine/logdog/coordinator/config" 13 "github.com/luci/luci-go/appengine/logdog/coordinator/config"
15 "github.com/luci/luci-go/appengine/tumble" 14 "github.com/luci/luci-go/appengine/tumble"
15 "github.com/luci/luci-go/server/router"
16 16
17 // Include mutations package so its Mutations will register with tumble via 17 // Include mutations package so its Mutations will register with tumble via
18 // init(). 18 // init().
19 _ "github.com/luci/luci-go/appengine/logdog/coordinator/mutations" 19 _ "github.com/luci/luci-go/appengine/logdog/coordinator/mutations"
20 ) 20 )
21 21
22 func init() { 22 func init() {
23 tmb := tumble.Service{ 23 tmb := tumble.Service{
24 Middleware: func(c context.Context) context.Context { 24 Middleware: func(c context.Context) context.Context {
25 if err := config.UseConfig(&c); err != nil { 25 if err := config.UseConfig(&c); err != nil {
26 panic(err) 26 panic(err)
27 } 27 }
28 c = coordinator.UseProdServices(c) 28 c = coordinator.UseProdServices(c)
29 return c 29 return c
30 }, 30 },
31 } 31 }
32 32
33 » router := httprouter.New() 33 » r := router.New()
34 » tmb.InstallHandlers(router) 34 » tmb.InstallHandlers(r)
35 35
36 » http.Handle("/", router) 36 » http.Handle("/", r)
37 } 37 }
OLDNEW
« no previous file with comments | « appengine/cmd/helloworld_mvm/frontend/main.go ('k') | appengine/cmd/logdog_coordinator/services/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698