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

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: Switch to Tumble delayed mutations. 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.")
iannucci 2016/04/29 20:09:42 TODO: we'll probably want to filter by 'disabled'
dnj 2016/04/29 23:04:20 Done.
177 return nil, err
178 }
179
180 ids := make([]string, len(projects))
181 for i, p := range projects {
182 ids[i] = p.ID
183 }
184
185 // TODO(dnj): Restrict this by actual namespaces in datastore.
186 return ids, nil
187 }
188
172 // validateConfig checks the supplied Coordinator config object to ensure that 189 // validateConfig checks the supplied Coordinator config object to ensure that
173 // it meets a minimum configuration standard expected by our endpoitns and 190 // it meets a minimum configuration standard expected by our endpoitns and
174 // handlers. 191 // handlers.
175 func validateConfig(cc *svcconfig.Config) error { 192 func validateConfig(cc *svcconfig.Config) error {
176 switch { 193 switch {
177 case cc == nil: 194 case cc == nil:
178 return errors.New("configuration is nil") 195 return errors.New("configuration is nil")
179 case cc.GetCoordinator() == nil: 196 case cc.GetCoordinator() == nil:
180 return errors.New("no Coordinator configuration") 197 return errors.New("no Coordinator configuration")
181 default: 198 default:
(...skipping 15 matching lines...) Expand all
197 return nil, errors.New("no development configuration") 214 return nil, errors.New("no development configuration")
198 215
199 default: 216 default:
200 return nil, err 217 return nil, err
201 } 218 }
202 219
203 return &config.Config{ 220 return &config.Config{
204 Content: dcfg.Config, 221 Content: dcfg.Config,
205 }, nil 222 }, nil
206 } 223 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698