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/registra
tion" |
14 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/services
" | 15 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/services
" |
| 16 registrationPb "github.com/luci/luci-go/common/api/logdog_coordinator/re
gistration/v1" |
15 servicesPb "github.com/luci/luci-go/common/api/logdog_coordinator/servic
es/v1" | 17 servicesPb "github.com/luci/luci-go/common/api/logdog_coordinator/servic
es/v1" |
16 "github.com/luci/luci-go/server/middleware" | 18 "github.com/luci/luci-go/server/middleware" |
17 "github.com/luci/luci-go/server/prpc" | 19 "github.com/luci/luci-go/server/prpc" |
18 | 20 |
19 // Include mutations package so its Mutations will register with tumble
via | 21 // Include mutations package so its Mutations will register with tumble
via |
20 // init(). | 22 // init(). |
21 _ "github.com/luci/luci-go/appengine/logdog/coordinator/mutations" | 23 _ "github.com/luci/luci-go/appengine/logdog/coordinator/mutations" |
22 ) | 24 ) |
23 | 25 |
24 // base is the root of the middleware chain. | 26 // base is the root of the middleware chain. |
25 func base(h middleware.Handler) httprouter.Handle { | 27 func base(h middleware.Handler) httprouter.Handle { |
26 h = config.WithConfig(h) | 28 h = config.WithConfig(h) |
27 h = coordinator.WithProdServices(h) | 29 h = coordinator.WithProdServices(h) |
28 return gaemiddleware.BaseProd(h) | 30 return gaemiddleware.BaseProd(h) |
29 } | 31 } |
30 | 32 |
31 // Run installs and executes this site. | 33 // Run installs and executes this site. |
32 func init() { | 34 func init() { |
33 router := httprouter.New() | 35 router := httprouter.New() |
34 | 36 |
35 // Setup Cloud Endpoints. | 37 // Setup Cloud Endpoints. |
36 svr := prpc.Server{} | 38 svr := prpc.Server{} |
37 servicesPb.RegisterServicesServer(&svr, services.New()) | 39 servicesPb.RegisterServicesServer(&svr, services.New()) |
| 40 registrationPb.RegisterRegistrationServer(&svr, registration.New()) |
38 | 41 |
39 // Standard HTTP endpoints. | 42 // Standard HTTP endpoints. |
40 svr.InstallHandlers(router, base) | 43 svr.InstallHandlers(router, base) |
41 | 44 |
42 http.Handle("/", router) | 45 http.Handle("/", router) |
43 } | 46 } |
OLD | NEW |