Skip to content

Commit

Permalink
Respect the prefix configuration option
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseyhightower committed May 12, 2014
1 parent 74ed2ac commit 056b600
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion resource/template/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,22 @@ func (t *TemplateResource) setVars() error {
var err error
log.Debug("Retrieving keys from store")
log.Debug("Key prefix set to " + config.Prefix())
vars, err := t.storeClient.GetValues(t.Keys)
vars, err := t.storeClient.GetValues(appendPrefix(config.Prefix(), t.Keys))
if err != nil {
return err
}
t.Vars = cleanKeys(vars)
return nil
}

func appendPrefix(prefix string, keys []string) []string {
s := make([]string, len(keys))
for i, k := range keys {
s[i] = path.Join(prefix, k)
}
return s
}

// cleanKeys is used to transform the path based keys we
// get from the StoreClient to a more friendly format.
func cleanKeys(vars map[string]interface{}) map[string]interface{} {
Expand Down

0 comments on commit 056b600

Please sign in to comment.