From 3cabcbc31703b5eecefd5cfedad8fe7cf1c8f34a Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 17 Jan 2025 07:19:39 +0000 Subject: [PATCH] Allow addons cache path to be set by an environment variable --- src/Providers/ExtensionServiceProvider.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Providers/ExtensionServiceProvider.php b/src/Providers/ExtensionServiceProvider.php index 92432a21c5..3712cde802 100644 --- a/src/Providers/ExtensionServiceProvider.php +++ b/src/Providers/ExtensionServiceProvider.php @@ -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; @@ -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 )); }