github.com/ijc/docker-app@v0.6.1-0.20181012090447-c7ca8bc483fb/internal/renderer/mustache/driver.go (about) 1 // +build experimental 2 3 package mustache 4 5 import ( 6 "github.com/cbroglie/mustache" 7 "github.com/docker/app/internal/renderer" 8 "github.com/pkg/errors" 9 ) 10 11 func init() { 12 renderer.Register("mustache", &Driver{}) 13 } 14 15 // Driver is the mustache implementation of rendered drivers. 16 type Driver struct{} 17 18 // Apply applies the settings to the string 19 func (d *Driver) Apply(s string, settings map[string]interface{}) (string, error) { 20 data, err := mustache.Render(s, settings) 21 if err != nil { 22 return "", errors.Wrap(err, "failed to execute mustache template") 23 } 24 return data, nil 25 }