fix: grand ssh, provisioning, perms refactor

See coop-cloud/organising#280.
See coop-cloud/organising#273.
This commit is contained in:
2021-12-22 20:08:15 +01:00
parent 4c6d52c426
commit a07e71f7df
13 changed files with 106 additions and 118 deletions

View File

@ -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
}