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

Unified Diff: appengine/logdog/coordinator/endpoints/services/registerStream.go

Issue 1971493003: LogDog: Project READ access for user endpoints. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-service-config
Patch Set: Updated patchset dependency Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: appengine/logdog/coordinator/endpoints/services/registerStream.go
diff --git a/appengine/logdog/coordinator/endpoints/services/registerStream.go b/appengine/logdog/coordinator/endpoints/services/registerStream.go
index 22af8949c791fc949d8066394e9b0fc88def7a4a..3b015185d6ec0450b1e3e5731202cc13294ed132 100644
--- a/appengine/logdog/coordinator/endpoints/services/registerStream.go
+++ b/appengine/logdog/coordinator/endpoints/services/registerStream.go
@@ -10,6 +10,7 @@ import (
"github.com/golang/protobuf/proto"
ds "github.com/luci/gae/service/datastore"
"github.com/luci/luci-go/appengine/logdog/coordinator"
+ "github.com/luci/luci-go/appengine/logdog/coordinator/endpoints"
"github.com/luci/luci-go/appengine/logdog/coordinator/hierarchy"
"github.com/luci/luci-go/appengine/logdog/coordinator/mutations"
"github.com/luci/luci-go/appengine/tumble"
@@ -75,21 +76,22 @@ func (s *server) RegisterStream(c context.Context, req *logdog.RegisterStreamReq
}
prefix, _ := path.Split()
- // Load our config and archive expiration.
+ // Load our service and project configs.
cfg, err := coordinator.GetServices(c).Config(c)
if err != nil {
log.WithError(err).Errorf(c, "Failed to load configuration.")
return nil, grpcutil.Internal
}
- archiveDelayMax := cfg.Coordinator.ArchiveDelayMax.Duration()
- if archiveDelayMax < 0 {
- log.Fields{
- "archiveDelayMax": archiveDelayMax,
- }.Errorf(c, "Must have positive maximum archive delay.")
+ pcfg, err := coordinator.CurrentProjectConfig(c)
+ if err != nil {
+ log.WithError(err).Errorf(c, "Failed to load current project configuration.")
return nil, grpcutil.Internal
}
+ // Determine the archival expiration.
+ archiveDelayMax := endpoints.MinDuration(cfg.Coordinator.ArchiveDelayMax, pcfg.MaxStreamAge)
+
// Register our Prefix.
//
// This will also verify that our request secret matches the registered one,

Powered by Google App Engine
This is Rietveld 408576698