diff --git a/cli/app/new.go b/cli/app/new.go index 07dd7fc2..b0dbe26e 100644 --- a/cli/app/new.go +++ b/cli/app/new.go @@ -200,7 +200,7 @@ func action(c *cli.Context) error { } logrus.Debugf("'%s' sanitised as '%s' for new app", newAppName, sanitisedAppName) - if err := config.CopyAppEnvSample(recipe.Name, newAppName, newAppServer); err != nil { + if err := config.TemplateAppEnvSample(recipe.Name, newAppName, newAppServer, domain, recipe.Name); err != nil { logrus.Fatal(err) } diff --git a/pkg/config/app.go b/pkg/config/app.go index 92655d7e..9b6c5ad8 100644 --- a/pkg/config/app.go +++ b/pkg/config/app.go @@ -243,8 +243,8 @@ func GetAppNames() ([]string, error) { return appNames, nil } -// CopyAppEnvSample copies the example env file for the app into the users env files -func CopyAppEnvSample(appType, appName, server string) error { +// TemplateAppEnvSample copies the example env file for the app into the users env files +func TemplateAppEnvSample(appType, appName, server, domain, recipe string) error { envSamplePath := path.Join(ABRA_DIR, "apps", appType, ".env.sample") envSample, err := ioutil.ReadFile(envSamplePath) if err != nil { @@ -256,6 +256,9 @@ func CopyAppEnvSample(appType, appName, server string) error { return fmt.Errorf("%s already exists?", appEnvPath) } + envSample = []byte(strings.Replace(string(envSample), fmt.Sprintf("%s.example.com", recipe), domain, -1)); + envSample = []byte(strings.Replace(string(envSample), "example.com", domain, -1)); + err = ioutil.WriteFile(appEnvPath, envSample, 0755) if err != nil { return err