英文:
Laravel Spatie backup save to s3 folder without creating subdirectory
问题
I have spatie/laravel-backup v8.1.7 and I want to save to a s3 folder named backups
To acheive this in filesystems.php I've added the following:
'backups' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'root' => 'backups', // specify the root directory for backups
],
In backup.php config file under destination I have:
'destination' => [
'filename_prefix' => 'backup_',
'disks' => [
'backups',
],
],
Now when it get saved to s3, it seems to first create a subdirectory using the name
=> env('APP_NAME', 'laravel-backup'), config variable and inside that it creates the backup file e.g. backups/laravel-backup/backup_2023-03-03-14-41-58.zip
How do i configure it so that is creates the backup directly in the s3 backup folder without creating a further subdirectory e.g. backups/backup_2023-03-03-14-41-58.zip
英文:
I have spatie/laravel-backup v8.1.7 and I want to save to a s3 folder named backups
To acheive this in filesystems.php I've added the following:
'backups' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'root' => 'backups', // specify the root directory for backups
],
In backup.php config file under destination I have:
'destination' => [
'filename_prefix' => 'backup_',
'disks' => [
'backups',
],
],
Now when it get saved to s3, it seems to first create a subdirectory using the 'name' => env('APP_NAME', 'laravel-backup'),
config variable and inside that it creates the backup file e.g. backups/laravel-backup/backup_2023-03-03-14-41-58.zip
How do i configure it so that is creates the backup directly in the s3 backup folder without creating a further subdirectory e.g. backups/backup_2023-03-03-14-41-58.zip
答案1
得分: 1
成功解决了,只需将以下变量重命名为:
'name' => env('APP_NAME', 'laravel-backup')
改为
'name' => env('BACKUP_FOLDER', 'backups')
这样,我也不需要在filesystem.php文件中配置备份磁盘 - 我可以直接使用已在其中定义的现有S3配置。
英文:
Managed to resolve by simply renaming the following variable:
'name' => env('APP_NAME', 'laravel-backup')
To
'name' => env('BACKUP_FOLDER', 'backups')
This way i don't need to configure the backup disk in the filesystem.php file either - I can just use my existing s3 configuration that already defined in there.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论