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

[5.x] Allow addons cache path to be set by an environment variable #11365

Merged

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented Jan 17, 2025

When deploying on Vercel I'm running into an issue with the addon cache not being writeable as its hard coded to boostrap/cache/addons.php

Exception:
The /var/task/user/bootstrap/cache directory must be present and writable.

  at /var/task/user/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php:178
  at Illuminate\Foundation\PackageManifest->write(array('statamic-rad-pack/shopify' => array('id' => 'statamic-rad-pack/shopify', 'slug' => null, 'editions' => array(), 'marketplaceId' => null, 'marketplaceSlug' => null, 'marketplaceUrl' => null, 'marketplaceSellerSlug' => null, 'latestVersion' => null, 'version' => '2.0.0-beta1', 'namespace' => 'StatamicRadPack\\Shopify', 'autoload' => 'src', 'provider' => 'StatamicRadPack\\Shopify\\ServiceProvider', 'name' => 'Shopify', 'url' => null, 'description' => 'Shopify Addon for Statamic', 'developer' => 'Jack Whiting', 'developerUrl' => 'https://jackwhiting.co.uk', 'email' => null)))
     (/var/task/user/vendor/statamic/cms/src/Extend/Manifest.php:25)

Laravel allow environment variables to be set to override their cache paths - see examples at:
https://github.com/laravel/framework/blob/2e5054a19ba55b335bf8df43a8ae7e032244f671/src/Illuminate/Foundation/Application.php#L1256-L1269

This PR adds support for a STATAMIC_ADDONS_CACHE environment variable to set the path to this cache, in the same way Laravel allows, for example STATAMIC_ADDONS_CACHE="/tmp/addons.php". This will allow deploying on Vercel to work again.

Ideally we'd use their normalizeCachePath() function but it's not public.

@jasonvarga jasonvarga merged commit d337a2f into statamic:5.x Jan 22, 2025
20 checks passed
@ryanmitchell ryanmitchell deleted the feature/addons-cache-path-variable branch January 22, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants