NewBackupsFilesystem creates a new local or S3 filesystem instance for managing app backups based on the current app settings. NB! Make sure to call Close() on the returned result after you are done working with it.
()
| 734 | // NB! Make sure to call Close() on the returned result |
| 735 | // after you are done working with it. |
| 736 | func (app *BaseApp) NewBackupsFilesystem() (*filesystem.System, error) { |
| 737 | if app.settings != nil && app.settings.Backups.S3.Enabled { |
| 738 | return filesystem.NewS3( |
| 739 | app.settings.Backups.S3.Bucket, |
| 740 | app.settings.Backups.S3.Region, |
| 741 | app.settings.Backups.S3.Endpoint, |
| 742 | app.settings.Backups.S3.AccessKey, |
| 743 | app.settings.Backups.S3.Secret, |
| 744 | app.settings.Backups.S3.ForcePathStyle, |
| 745 | ) |
| 746 | } |
| 747 | |
| 748 | // fallback to local filesystem |
| 749 | return filesystem.NewLocal(filepath.Join(app.DataDir(), LocalBackupsDirName)) |
| 750 | } |
| 751 | |
| 752 | // Restart restarts (aka. replaces) the current running application process. |
| 753 | // |