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 main | 5 package main |
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/admin" | 14 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/admin" |
15 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/logs" | 15 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/logs" |
| 16 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/registra
tion" |
16 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/services
" | 17 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/services
" |
17 adminPb "github.com/luci/luci-go/common/api/logdog_coordinator/admin/v1" | 18 adminPb "github.com/luci/luci-go/common/api/logdog_coordinator/admin/v1" |
18 logsPb "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" | 19 logsPb "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" |
| 20 registrationPb "github.com/luci/luci-go/common/api/logdog_coordinator/re
gistration/v1" |
19 servicesPb "github.com/luci/luci-go/common/api/logdog_coordinator/servic
es/v1" | 21 servicesPb "github.com/luci/luci-go/common/api/logdog_coordinator/servic
es/v1" |
20 log "github.com/luci/luci-go/common/logging" | 22 log "github.com/luci/luci-go/common/logging" |
21 "github.com/luci/luci-go/server/discovery" | 23 "github.com/luci/luci-go/server/discovery" |
22 "github.com/luci/luci-go/server/middleware" | 24 "github.com/luci/luci-go/server/middleware" |
23 "github.com/luci/luci-go/server/prpc" | 25 "github.com/luci/luci-go/server/prpc" |
24 "golang.org/x/net/context" | 26 "golang.org/x/net/context" |
25 "google.golang.org/appengine" | 27 "google.golang.org/appengine" |
26 | 28 |
27 // Include mutations package so its Mutations will register with tumble
via | 29 // Include mutations package so its Mutations will register with tumble
via |
28 // init(). | 30 // init(). |
(...skipping 14 matching lines...) Expand all Loading... |
43 // Run installs and executes this site. | 45 // Run installs and executes this site. |
44 func main() { | 46 func main() { |
45 router := httprouter.New() | 47 router := httprouter.New() |
46 | 48 |
47 // Setup Cloud Endpoints. | 49 // Setup Cloud Endpoints. |
48 svr := prpc.Server{ | 50 svr := prpc.Server{ |
49 AccessControl: accessControl, | 51 AccessControl: accessControl, |
50 } | 52 } |
51 adminPb.RegisterAdminServer(&svr, admin.New()) | 53 adminPb.RegisterAdminServer(&svr, admin.New()) |
52 servicesPb.RegisterServicesServer(&svr, services.New()) | 54 servicesPb.RegisterServicesServer(&svr, services.New()) |
| 55 registrationPb.RegisterRegistrationServer(&svr, registration.New()) |
53 logsPb.RegisterLogsServer(&svr, logs.New()) | 56 logsPb.RegisterLogsServer(&svr, logs.New()) |
54 discovery.Enable(&svr) | 57 discovery.Enable(&svr) |
55 | 58 |
56 // Standard HTTP endpoints. | 59 // Standard HTTP endpoints. |
57 gaemiddleware.InstallHandlers(router, base(false)) | 60 gaemiddleware.InstallHandlers(router, base(false)) |
58 svr.InstallHandlers(router, base(true)) | 61 svr.InstallHandlers(router, base(true)) |
59 | 62 |
60 // Redirect "/" to "/app/". | 63 // Redirect "/" to "/app/". |
61 router.GET("/", func(w http.ResponseWriter, r *http.Request, ps httprout
er.Params) { | 64 router.GET("/", func(w http.ResponseWriter, r *http.Request, ps httprout
er.Params) { |
62 http.Redirect(w, r, "/app/", http.StatusFound) | 65 http.Redirect(w, r, "/app/", http.StatusFound) |
(...skipping 15 matching lines...) Expand all Loading... |
78 return false | 81 return false |
79 } | 82 } |
80 | 83 |
81 for _, o := range ccfg.RpcAllowOrigins { | 84 for _, o := range ccfg.RpcAllowOrigins { |
82 if o == origin { | 85 if o == origin { |
83 return true | 86 return true |
84 } | 87 } |
85 } | 88 } |
86 return false | 89 return false |
87 } | 90 } |
OLD | NEW |