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

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

Issue 1672833003: LogDog: Add log rendering view. Base URL: https://github.com/luci/luci-go@master
Patch Set: Clean up, add tests, little reorg. Created 4 years, 10 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
« no previous file with comments | « no previous file | appengine/logdog/coordinator/backend/archive.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 gaeauthServer "github.com/luci/luci-go/appengine/gaeauth/server" 11 gaeauthServer "github.com/luci/luci-go/appengine/gaeauth/server"
12 "github.com/luci/luci-go/appengine/gaemiddleware" 12 "github.com/luci/luci-go/appengine/gaemiddleware"
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/services " 16 "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints/services "
17 "github.com/luci/luci-go/appengine/logdog/coordinator/logView"
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"
19 servicesPb "github.com/luci/luci-go/common/api/logdog_coordinator/servic es/v1" 20 servicesPb "github.com/luci/luci-go/common/api/logdog_coordinator/servic es/v1"
20 log "github.com/luci/luci-go/common/logging" 21 log "github.com/luci/luci-go/common/logging"
21 "github.com/luci/luci-go/server/discovery" 22 "github.com/luci/luci-go/server/discovery"
22 "github.com/luci/luci-go/server/middleware" 23 "github.com/luci/luci-go/server/middleware"
23 "github.com/luci/luci-go/server/prpc" 24 "github.com/luci/luci-go/server/prpc"
24 "golang.org/x/net/context" 25 "golang.org/x/net/context"
25 "google.golang.org/appengine" 26 "google.golang.org/appengine"
26 ) 27 )
(...skipping 12 matching lines...) Expand all
39 router := httprouter.New() 40 router := httprouter.New()
40 41
41 // Setup Cloud Endpoints. 42 // Setup Cloud Endpoints.
42 svr := prpc.Server{ 43 svr := prpc.Server{
43 AccessControl: accessControl, 44 AccessControl: accessControl,
44 } 45 }
45 adminPb.RegisterAdminServer(&svr, &admin.Server{}) 46 adminPb.RegisterAdminServer(&svr, &admin.Server{})
46 servicesPb.RegisterServicesServer(&svr, &services.Server{}) 47 servicesPb.RegisterServicesServer(&svr, &services.Server{})
47 logsPb.RegisterLogsServer(&svr, &logs.Server{}) 48 logsPb.RegisterLogsServer(&svr, &logs.Server{})
48 discovery.Enable(&svr) 49 discovery.Enable(&svr)
50 svr.InstallHandlers(router, base)
49 51
52 // Setup log view handler.
53 vh := logView.Handler{}
54 vh.InstallHandlers(router, base)
55
56 // Support HTTP endpoints.
50 gaeauthServer.InstallHandlers(router, base) 57 gaeauthServer.InstallHandlers(router, base)
51 svr.InstallHandlers(router, base)
52 58
53 http.Handle("/", router) 59 http.Handle("/", router)
54 appengine.Main() 60 appengine.Main()
55 } 61 }
56 62
57 func accessControl(c context.Context, origin string) bool { 63 func accessControl(c context.Context, origin string) bool {
58 cfg, err := config.Load(c) 64 cfg, err := config.Load(c)
59 if err != nil { 65 if err != nil {
60 log.WithError(err).Errorf(c, "Failed to get config for access co ntrol check.") 66 log.WithError(err).Errorf(c, "Failed to get config for access co ntrol check.")
61 return false 67 return false
62 } 68 }
63 69
64 ccfg := cfg.GetCoordinator() 70 ccfg := cfg.GetCoordinator()
65 if ccfg == nil { 71 if ccfg == nil {
66 return false 72 return false
67 } 73 }
68 74
69 for _, o := range ccfg.RpcAllowOrigins { 75 for _, o := range ccfg.RpcAllowOrigins {
70 if o == origin { 76 if o == origin {
71 return true 77 return true
72 } 78 }
73 } 79 }
74 return false 80 return false
75 } 81 }
OLDNEW
« no previous file with comments | « no previous file | appengine/logdog/coordinator/backend/archive.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698