-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oracle Cloud Infra File Storage Compatibility #1799
Comments
Finally managed to make it work You can follow this tutorial but you will have to make some changes in your Provider As mentionned in the Official Laravel Documentation you need to update the implementation Here's my working implementation with :
<?php
namespace App\Providers;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\ServiceProvider;
use Aws\S3\S3Client;
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
use League\Flysystem\Filesystem;
use Illuminate\Support\Facades\Storage;
class OciObjectStorageServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
//
}
public function boot()
{
if (config('filesystems.default') !== 'oci') {
return;
}
Storage::extend('s3', function($app, $config) {
$myConfig = [
'credentials' => [
'key' => $config['key'],
'secret' => $config['secret'],
],
'region' => $config['region'],
'version' => '2006-03-01',
'use_path_style_endpoint' => true, // Set to true if you are using an S3 clone
'bucket_endpoint' => true,
'endpoint' => $config['url']
];
$client = new S3Client($myConfig);
$adapter = new AwsS3V3Adapter($client, $config['bucket']);
return new FilesystemAdapter(
new Filesystem($adapter, $config),
$adapter,
$myConfig
);
});
}
} You can give such a try in one of your controller (for the sake of the test) : Storage::disk('oci')->put('test.txt', 'Hello World'); Enjoy 🚀 |
Hello, Can you show me how is your config OCI file in filesystem.php? how u set the URL parm? any way i used has problems.. |
@olivier1208 Hello, Can you show me how is your config OCI file in filesystem.php? how u set the URL parm? any way i used has problems.. |
As simple as that : 'oci' => [
'driver' => 's3',
'key' => env('OCI_ACCESS_KEY_ID'),
'secret' => env('OCI_SECRET_ACCESS_KEY'),
'region' => env('OCI_DEFAULT_REGION'),
'bucket' => env('OCI_BUCKET'),
'url' => env('OCI_URL') . '/'. env('OCI_BUCKET'),
], Asssumed you have this in your FILESYSTEM_DISK=oci
OCI_ACCESS_KEY_ID=yout_access_key
OCI_SECRET_ACCESS_KEY=your_secret_key
OCI_DEFAULT_REGION=your_region
OCI_BUCKET=your_bucket
OCI_URL=https://your_namespace.compat.objectstorage.your_region.oraclecloud.com
OCI_USE_PATH_STYLE_ENDPOINT=false |
Bug Report
Summary
How to reproduce
Unable to integrate OCI in laravel 10 with this flysystem.
The text was updated successfully, but these errors were encountered: