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

Side by Side Diff: appengine/logdog/coordinator/config/config.go

Issue 1910633006: LogDog: Support per-namespace expired archival. (Closed) Base URL: https://github.com/luci/luci-go@logdog-coordinator-svcdec
Patch Set: Update another test. 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 unified diff | Download patch
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 config 5 package config
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 9
10 "github.com/golang/protobuf/proto" 10 "github.com/golang/protobuf/proto"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 // Validate the configuration. 163 // Validate the configuration.
164 if err := validateConfig(&cc); err != nil { 164 if err := validateConfig(&cc); err != nil {
165 log.WithError(err).Errorf(c, "Invalid Coordinator configuration. ") 165 log.WithError(err).Errorf(c, "Invalid Coordinator configuration. ")
166 return nil, settings.ErrNoSettings 166 return nil, settings.ErrNoSettings
167 } 167 }
168 168
169 return &cc, nil 169 return &cc, nil
170 } 170 }
171 171
172 // Projects lists the registered LogDog projects.
173 func (gcfg *GlobalConfig) Projects(c context.Context) ([]string, error) {
174 projects, err := config.Get(c).GetProjects()
175 if err != nil {
176 log.WithError(err).Errorf(c, "Failed to list 'luci-config' proje cts.")
177 return nil, err
178 }
179
180 // TODO(dnj): Filter this list to projects with active LogDog configs, o nce we
181 // move to project-specific configurations.
182
183 ids := make([]string, len(projects))
184 for i, p := range projects {
185 ids[i] = p.ID
186 }
187
188 // TODO(dnj): Restrict this by actual namespaces in datastore.
189 return ids, nil
190 }
191
172 // validateConfig checks the supplied Coordinator config object to ensure that 192 // validateConfig checks the supplied Coordinator config object to ensure that
173 // it meets a minimum configuration standard expected by our endpoitns and 193 // it meets a minimum configuration standard expected by our endpoitns and
174 // handlers. 194 // handlers.
175 func validateConfig(cc *svcconfig.Config) error { 195 func validateConfig(cc *svcconfig.Config) error {
176 switch { 196 switch {
177 case cc == nil: 197 case cc == nil:
178 return errors.New("configuration is nil") 198 return errors.New("configuration is nil")
179 case cc.GetCoordinator() == nil: 199 case cc.GetCoordinator() == nil:
180 return errors.New("no Coordinator configuration") 200 return errors.New("no Coordinator configuration")
181 default: 201 default:
(...skipping 15 matching lines...) Expand all
197 return nil, errors.New("no development configuration") 217 return nil, errors.New("no development configuration")
198 218
199 default: 219 default:
200 return nil, err 220 return nil, err
201 } 221 }
202 222
203 return &config.Config{ 223 return &config.Config{
204 Content: dcfg.Config, 224 Content: dcfg.Config,
205 }, nil 225 }, nil
206 } 226 }
OLDNEW
« no previous file with comments | « appengine/logdog/coordinator/backend/util_test.go ('k') | appengine/logdog/coordinator/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698