From 2cddd7faf0a94677728c7dc28aba9d5c1a0702b3 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 11 Jun 2021 14:26:10 -0700 Subject: [PATCH] Fixed filesystem config Signed-off-by: snipe --- config/filesystems.php | 94 +++++++++++++++++++++++++++++------------- 1 file changed, 65 insertions(+), 29 deletions(-) diff --git a/config/filesystems.php b/config/filesystems.php index 10c9d9be2a..50b2675589 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -1,6 +1,6 @@ env('FILESYSTEM_DRIVER', 'local'), + 'default' => env('PRIVATE_FILESYSTEM_DISK', 'local'), + + /* + |-------------------------------------------------------------------------- + | Default Cloud Filesystem Disk + |-------------------------------------------------------------------------- + | + | Many applications store files both locally and in the cloud. For this + | reason, you may specify a default "cloud" driver here. This driver + | will be bound as the Cloud disk implementation in the container. + | + */ + + 'cloud' => env('FILESYSTEM_CLOUD', 's3'), /* |-------------------------------------------------------------------------- @@ -24,7 +37,7 @@ return [ | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | - | Supported Drivers: "local", "ftp", "sftp", "s3" + | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" | */ @@ -32,41 +45,64 @@ return [ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => storage_path(), ], - 'public' => [ + // This applies the LOCAL public only, not S3/FTP/etc + 'local_public' => [ 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'root' => public_path('uploads'), + 'url' => env('APP_URL').'/uploads', 'visibility' => 'public', ], - 's3' => [ + 's3_public' => [ 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), + 'key' => env('PUBLIC_AWS_ACCESS_KEY_ID'), + 'secret' => env('PUBLIC_AWS_SECRET_ACCESS_KEY'), + 'region' => env('PUBLIC_AWS_DEFAULT_REGION'), + 'bucket' => env('PUBLIC_AWS_BUCKET'), + 'url' => env('PUBLIC_AWS_URL'), + 'root' => env('PUBLIC_AWS_BUCKET_ROOT'), + 'visibility' => 'public' + ], + + 's3_private' => [ + // This bucket (if different than the 's3' bucket above) can be + // configured within AWS to *never* permit public documents + // For security reasons, its best to use separate buckets for + // public and private documents in S3 + 'driver' => 's3', + 'key' => env('PRIVATE_AWS_ACCESS_KEY_ID'), + 'secret' => env('PRIVATE_AWS_SECRET_ACCESS_KEY'), + 'region' => env('PRIVATE_AWS_DEFAULT_REGION'), + 'bucket' => env('PRIVATE_AWS_BUCKET'), + 'url' => env('PRIVATE_AWS_URL'), + 'root' => env('PRIVATE_AWS_BUCKET_ROOT'), + 'visibility' => 'private' + ], + + 'rackspace' => [ + 'driver' => 'rackspace', + 'username' => env('RACKSPACE_USERNAME'), + 'key' => env('RACKSPACE_KEY'), + 'container' => env('RACKSPACE_CONTAINER'), + 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/', + 'region' => env('RACKSPACE_REGION'), + 'url_type' => env('RACKSPACE_URL_TYPE'), + ], + + 'backup' => [ + 'driver' => env('PRIVATE_FILESYSTEM_DISK', 'local'), + 'root' => storage_path('app'), ], ], - /* - |-------------------------------------------------------------------------- - | Symbolic Links - |-------------------------------------------------------------------------- - | - | Here you may configure the symbolic links that will be created when the - | `storage:link` Artisan command is executed. The array keys should be - | the locations of the links and the values should be their targets. - | - */ - - 'links' => [ - public_path('storage') => storage_path('app/public'), - ], - ]; + +// copy the selected PUBLIC_FILESYSTEM_DISK's configuration to the 'public' key for easy use +// (by default, the PUBLIC_FILESYSTEM DISK is 'local_public', in the public/uploads directory) +$config['disks']['public'] = $config['disks'][env('PUBLIC_FILESYSTEM_DISK','local_public')]; + +return $config; \ No newline at end of file