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

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

Issue 2575383002: Add server/cache support to gaeconfig. (Closed)
Patch Set: Created 4 years 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: dm/api/template/loader.go
diff --git a/dm/api/template/loader.go b/dm/api/template/loader.go
index af6b6b97aff1cce80ef92c37e8b4c90b56f0782b..3edf73501b87be4949e5bd1286d7e7985a7358ac 100644
--- a/dm/api/template/loader.go
+++ b/dm/api/template/loader.go
@@ -9,10 +9,10 @@ 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/server/config"
+ "github.com/luci/luci-go/server/config/textproto"
)
// LoadFile loads a File by configSet and path.
@@ -21,16 +21,13 @@ func LoadFile(c context.Context, project, ref string) (file *File, vers string,
if ref != "" {
cfgSet += "/" + ref
}
- templateData, err := config.GetConfig(c, cfgSet, "dm/quest_templates.cfg", false)
- if err != nil {
- return
- }
+
file = &File{}
- vers = templateData.ContentHash
- err = proto.UnmarshalTextML(templateData.Content, file)
- if err != nil {
+ var meta config.Meta
+ if err = config.Get(c, config.AsService, cfgSet, "dm/quest_templates.cfg", textproto.Message(file), &meta); err != nil {
return
}
+ vers = meta.ContentHash
err = file.Normalize()
return
}

Powered by Google App Engine
This is Rietveld 408576698