OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // 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 "github.com/julienschmidt/httprouter" | 10 "github.com/julienschmidt/httprouter" |
11 "github.com/luci/luci-go/appengine/gaemiddleware" | 11 "github.com/luci/luci-go/appengine/gaemiddleware" |
12 "github.com/luci/luci-go/appengine/logdog/coordinator" | 12 "github.com/luci/luci-go/appengine/logdog/coordinator" |
13 "github.com/luci/luci-go/appengine/logdog/coordinator/config" | 13 "github.com/luci/luci-go/appengine/logdog/coordinator/config" |
14 » "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/services
" | 14 » "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/registra
tion" |
15 » servicesPb "github.com/luci/luci-go/common/api/logdog_coordinator/servic
es/v1" | 15 » registrationPb "github.com/luci/luci-go/common/api/logdog_coordinator/re
gistration/v1" |
16 "github.com/luci/luci-go/server/middleware" | 16 "github.com/luci/luci-go/server/middleware" |
17 "github.com/luci/luci-go/server/prpc" | 17 "github.com/luci/luci-go/server/prpc" |
18 | 18 |
19 // Include mutations package so its Mutations will register with tumble
via | 19 // Include mutations package so its Mutations will register with tumble
via |
20 // init(). | 20 // init(). |
21 _ "github.com/luci/luci-go/appengine/logdog/coordinator/mutations" | 21 _ "github.com/luci/luci-go/appengine/logdog/coordinator/mutations" |
22 ) | 22 ) |
23 | 23 |
24 // base is the root of the middleware chain. | 24 // base is the root of the middleware chain. |
25 func base(h middleware.Handler) httprouter.Handle { | 25 func base(h middleware.Handler) httprouter.Handle { |
26 h = config.WithConfig(h) | 26 h = config.WithConfig(h) |
27 h = coordinator.WithProdServices(h) | 27 h = coordinator.WithProdServices(h) |
28 return gaemiddleware.BaseProd(h) | 28 return gaemiddleware.BaseProd(h) |
29 } | 29 } |
30 | 30 |
31 // Run installs and executes this site. | 31 // Run installs and executes this site. |
32 func init() { | 32 func init() { |
33 router := httprouter.New() | 33 router := httprouter.New() |
34 | 34 |
35 // Setup Cloud Endpoints. | 35 // Setup Cloud Endpoints. |
36 svr := prpc.Server{} | 36 svr := prpc.Server{} |
37 » servicesPb.RegisterServicesServer(&svr, services.New()) | 37 » registrationPb.RegisterRegistrationServer(&svr, registration.New()) |
38 | 38 |
39 // Standard HTTP endpoints. | 39 // Standard HTTP endpoints. |
40 svr.InstallHandlers(router, base) | 40 svr.InstallHandlers(router, base) |
41 | 41 |
42 http.Handle("/", router) | 42 http.Handle("/", router) |
43 } | 43 } |
OLD | NEW |