refactor: migrate the app deploy lock to the data directory

This removes it from the app path, hopefully making backups a bit easier to perform.
This commit is contained in:
Jose Diaz-Gonzalez
2023-08-27 13:10:45 -04:00
parent 4b480ae964
commit e61421b53b
7 changed files with 43 additions and 14 deletions

View File

@@ -17,8 +17,8 @@ func appExists(appName string) error {
// checks if an app is locked
func appIsLocked(appName string) bool {
lockfilePath := fmt.Sprintf("%v/.deploy.lock", common.AppRoot(appName))
_, err := os.Stat(lockfilePath)
lockPath := getLockPath(appName)
_, err := os.Stat(lockPath)
return !os.IsNotExist(err)
}
@@ -94,6 +94,11 @@ func destroyApp(appName string) error {
return nil
}
// returns the lock path
func getLockPath(appName string) string {
return fmt.Sprintf("%v/.deploy.lock", common.GetDataDirectory(appName))
}
// creates an app if allowed
func maybeCreateApp(appName string) error {
if err := appExists(appName); err == nil {