fix: report config write failures instead of exiting 0
`config:set`, `config:unset` and `config:clear` discarded the result of writing the app's environment, so a write that never landed still printed `Setting config vars`, still fired the `post-config-update` trigger, still restarted the app and still exited 0. The `config-set` and `config-unset` plugin triggers behaved the same way, which meant an `app.json` `env` block that could not be persisted deployed anyway with the variables missing. The environment is now staged in a temporary file and renamed into place, so a write that fails partway leaves the previous environment intact, and that file is created at `0600` rather than being created at `0644` and chmodded afterwards. `apps:clone` and `apps:rename` never applied that chmod at all and left the new app's environment world-readable.
This commit is contained in:
11 files changed
+369
-43
No files matched your search
@@ -115,13 +115,6 @@ func drainLegacyEnvFile(name string, oldEnvFile string, env *Env) error {
|
||||
return fmt.Errorf("Unable to write environment: %s", err.Error())
|
||||
}
|
||||
|
||||
if err := common.SetPermissions(common.SetPermissionInput{
|
||||
Filename: env.Filename(),
|
||||
Mode: os.FileMode(0600),
|
||||
}); err != nil {
|
||||
return fmt.Errorf("Unable to set permissions on environment: %s", err.Error())
|
||||
}
|
||||
|
||||
if err := writeEnvMigrated(name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user