| OLD | NEW |
| 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 gaemiddleware | 5 package gaemiddleware |
| 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" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // It is indirectly stateful (since NewDBCache returns a stateful object
that | 48 // It is indirectly stateful (since NewDBCache returns a stateful object
that |
| 49 // keeps AuthDB cache in local memory), and thus it's defined as a long
living | 49 // keeps AuthDB cache in local memory), and thus it's defined as a long
living |
| 50 // global variable. | 50 // global variable. |
| 51 // | 51 // |
| 52 // Used in prod contexts only. | 52 // Used in prod contexts only. |
| 53 globalAuthConfig = auth.Config{ | 53 globalAuthConfig = auth.Config{ |
| 54 DBProvider: authdb.NewDBCache(server.GetAuthDB), | 54 DBProvider: authdb.NewDBCache(server.GetAuthDB), |
| 55 Signer: gaesigner.Signer{}, | 55 Signer: gaesigner.Signer{}, |
| 56 AccessTokenProvider: client.GetAccessToken, | 56 AccessTokenProvider: client.GetAccessToken, |
| 57 AnonymousTransport: urlfetch.Get, | 57 AnonymousTransport: urlfetch.Get, |
| 58 » » GlobalCache: &server.Memcache{Namespace: "__luciauth__"}
, | 58 » » Cache: &server.Memcache{Namespace: "__luciauth__"}
, |
| 59 } | 59 } |
| 60 | 60 |
| 61 // globalTsMonState holds state related to time series monitoring. | 61 // globalTsMonState holds state related to time series monitoring. |
| 62 globalTsMonState = &tsmon.State{} | 62 globalTsMonState = &tsmon.State{} |
| 63 ) | 63 ) |
| 64 | 64 |
| 65 // WithProd installs the set of standard production AppEngine services: | 65 // WithProd installs the set of standard production AppEngine services: |
| 66 // * github.com/luci/luci-go/common/logging (set default level to debug). | 66 // * github.com/luci/luci-go/common/logging (set default level to debug). |
| 67 // * github.com/luci/gae/impl/prod (production appengine services) | 67 // * github.com/luci/gae/impl/prod (production appengine services) |
| 68 // * github.com/luci/luci-go/appengine/gaeauth/client (appengine urlfetch tran
sport) | 68 // * github.com/luci/luci-go/appengine/gaeauth/client (appengine urlfetch tran
sport) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // BaseProd returns a list of middleware: WithProd middleware, a panic catcher i
f this | 116 // BaseProd returns a list of middleware: WithProd middleware, a panic catcher i
f this |
| 117 // is not a devserver, and the monitoring middleware. | 117 // is not a devserver, and the monitoring middleware. |
| 118 func BaseProd() router.MiddlewareChain { | 118 func BaseProd() router.MiddlewareChain { |
| 119 if appengine.IsDevAppServer() { | 119 if appengine.IsDevAppServer() { |
| 120 return router.NewMiddlewareChain(ProdServices, globalTsMonState.
Middleware) | 120 return router.NewMiddlewareChain(ProdServices, globalTsMonState.
Middleware) |
| 121 } | 121 } |
| 122 return router.NewMiddlewareChain( | 122 return router.NewMiddlewareChain( |
| 123 ProdServices, middleware.WithPanicCatcher, globalTsMonState.Midd
leware, | 123 ProdServices, middleware.WithPanicCatcher, globalTsMonState.Midd
leware, |
| 124 ) | 124 ) |
| 125 } | 125 } |
| OLD | NEW |