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

Unified Diff: dm/api/template/loader.go

Issue 2575383002: Add server/cache support to gaeconfig. (Closed)
Patch Set: Un-collapse. Created 3 years, 11 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
« no previous file with comments | « common/data/text/templateproto/loader_test.go ('k') | dm/appengine/deps/auth.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/api/template/loader.go
diff --git a/dm/api/template/loader.go b/dm/api/template/loader.go
index af6b6b97aff1cce80ef92c37e8b4c90b56f0782b..567951b8224a6f3d5b8ab995d6516ce246353161 100644
--- a/dm/api/template/loader.go
+++ b/dm/api/template/loader.go
@@ -9,28 +9,24 @@ import (
"golang.org/x/net/context"
- "github.com/luci/luci-go/common/config"
"github.com/luci/luci-go/common/data/text/templateproto"
- "github.com/luci/luci-go/common/proto"
dm "github.com/luci/luci-go/dm/api/service/v1"
+ "github.com/luci/luci-go/luci_config/common/cfgtypes"
+ "github.com/luci/luci-go/luci_config/server/cfgclient"
+ "github.com/luci/luci-go/luci_config/server/cfgclient/textproto"
)
// LoadFile loads a File by configSet and path.
func LoadFile(c context.Context, project, ref string) (file *File, vers string, err error) {
- cfgSet := "projects/" + project
- if ref != "" {
- cfgSet += "/" + ref
- }
- templateData, err := config.GetConfig(c, cfgSet, "dm/quest_templates.cfg", false)
- if err != nil {
- return
- }
+ // If ref is "", this will be a standard project config set.
+ cfgSet := cfgtypes.RefConfigSet(cfgtypes.ProjectName(project), ref)
+
file = &File{}
- vers = templateData.ContentHash
- err = proto.UnmarshalTextML(templateData.Content, file)
- if err != nil {
+ var meta cfgclient.Meta
+ if err = cfgclient.Get(c, cfgclient.AsService, cfgSet, "dm/quest_templates.cfg", textproto.Message(file), &meta); err != nil {
return
}
+ vers = meta.ContentHash
err = file.Normalize()
return
}
« no previous file with comments | « common/data/text/templateproto/loader_test.go ('k') | dm/appengine/deps/auth.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698