forked from toolshed/abra
fix: grand ssh, provisioning, perms refactor
See coop-cloud/organising#280. See coop-cloud/organising#273.
This commit is contained in:
@ -248,22 +248,22 @@ func GetAppNames() ([]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")
|
||||
func TemplateAppEnvSample(recipe, appName, server, domain string) error {
|
||||
envSamplePath := path.Join(ABRA_DIR, "apps", recipe, ".env.sample")
|
||||
envSample, err := ioutil.ReadFile(envSamplePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
appEnvPath := path.Join(ABRA_DIR, "servers", server, fmt.Sprintf("%s.env", appName))
|
||||
if _, err := os.Stat(appEnvPath); err == nil {
|
||||
if _, err := os.Stat(appEnvPath); os.IsExist(err) {
|
||||
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, 0644)
|
||||
err = ioutil.WriteFile(appEnvPath, envSample, 0664)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user