diff --git a/pkg/config/app.go b/pkg/config/app.go index 756d5efd..1d25eec3 100644 --- a/pkg/config/app.go +++ b/pkg/config/app.go @@ -2,7 +2,6 @@ package config import ( "fmt" - "html/template" "io/ioutil" "os" "path" @@ -321,25 +320,16 @@ func TemplateAppEnvSample(recipeName, appName, server, domain string) error { return err } - file, err := os.OpenFile(appEnvPath, os.O_RDWR, 0664) - if err != nil { - return err - } - defer file.Close() - - tpl, err := template.ParseFiles(appEnvPath) + read, err := ioutil.ReadFile(appEnvPath) if err != nil { return err } - type templateVars struct { - Name string - Domain string - } + newContents := strings.Replace(string(read), recipeName+".example.com", domain, -1) - tvars := templateVars{Name: recipeName, Domain: domain} - if err := tpl.Execute(file, tvars); err != nil { - return err + err = ioutil.WriteFile(appEnvPath, []byte(newContents), 0) + if err != nil { + panic(err) } logrus.Debugf("copied & templated %s to %s", envSamplePath, appEnvPath)