Skip to content

Commit

Permalink
[5.x] Allow addons cache path to be set by an environment variable (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell authored Jan 22, 2025
1 parent 2a446d2 commit d337a2f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Providers/ExtensionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Statamic\Providers;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Env;
use Illuminate\Support\ServiceProvider;
use Statamic\Actions;
use Statamic\Actions\Action;
Expand Down Expand Up @@ -258,10 +259,16 @@ public function register()

protected function registerAddonManifest()
{
$cachePath = $this->app->bootstrapPath().'/cache/addons.php';

if (! is_null($env = Env::get('STATAMIC_ADDONS_CACHE'))) {
$cachePath = Str::startsWith($env, ['/', '\\']) ? $env : $this->app->basePath($env);
}

$this->app->instance(Manifest::class, new Manifest(
new Filesystem,
$this->app->basePath(),
$this->app->bootstrapPath().'/cache/addons.php'
$cachePath
));
}

Expand Down

0 comments on commit d337a2f

Please sign in to comment.