Skip to content
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

You're overwriting possible settings on the Laravel disk #137

Closed
ollieread opened this issue Dec 18, 2024 · 0 comments · Fixed by #141
Closed

You're overwriting possible settings on the Laravel disk #137

ollieread opened this issue Dec 18, 2024 · 0 comments · Fixed by #141
Labels
bug Something isn't working

Comments

@ollieread
Copy link

When you're dynamically adding the config for the storage disk cloudinary you're overwriting any possible settings that a user may have added.

protected function bootCloudinaryDriver(): void
{
$this->app['config']['filesystems.disks.cloudinary'] = ['driver' => 'cloudinary'];
Storage::extend(
'cloudinary',
function ($app, $config) {
$cloudinaryAdapter = new CloudinaryAdapter(config('cloudinary.cloud_url'));
return new FilesystemAdapter(
new Filesystem($cloudinaryAdapter, $config),
$cloudinaryAdapter,
$config
);
}
);
}

You probably want something like:

if (! $this->app['config']->has('filesystems.disks.cloudinary')) {
	$this->app['config']['filesystems.disks.cloudinary'] = ['driver' => 'cloudinary'];
}

Or at the very least

if ($this->app['config']->has('filesystems.disks.cloudinary')) {
	$this->app['config']['filesystems.disks.cloudinary.driver'] = 'cloudinary';
} else {
	$this->app['config']['filesystems.disks.cloudinary'] = ['driver' => 'cloudinary'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants