Repository navigation
Load Bref only on Craft Cloud, detected by CRAFT_CLOUD - #219
Merged
Merged
Conversation
bref/laravel-bridge's boot() adds an upload route, middleware and job listeners on every machine. Keep it and bref/laravel-health-check out of package discovery, and register both from CloudServiceProvider on Craft Cloud only. Detect Craft Cloud with CRAFT_CLOUD instead of AWS_LAMBDA_RUNTIME_API. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Its only command, bref:health-check, is for bref.cloud's dashboard, which Craft Cloud doesn't use. It stays out of package discovery. Amp-Thread-ID: https://ampcode.com/threads/T-5e08134f-736d-4bda-8b28-d21654023ef7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bref/laravel-bridge auto-discovers in every project that requires
craftcms/cloud. Itsregister()returns early off Lambda, but itsboot()doesn't. So local dev and CI get:POST /signed-upload-urlrouteServeStaticAssetsmiddlewarequeue:failed-*commandsIt also pulls in
bref/laravel-health-check, which auto-discovers too.This PR:
extra.laravel.dont-discover. Laravel merges that list from every installed package, so it applies in projects that require us.CloudServiceProvider, on Craft Cloud only. The health check isn't registered anywhere: its only command,bref:health-check, is for bref.cloud's dashboard, which Craft Cloud doesn't use.CRAFT_CLOUD(0andfalsecount as off) instead ofAWS_LAMBDA_RUNTIME_API.laravel/octaneandlaravel/tinker, which the bridge requires, stay discoverable. They're general Laravel packages a project may use itself.Important
cloud-api doesn't set
CRAFT_CLOUDyet. Until it setsCRAFT_CLOUD=1on every function, this package configures nothing on Craft Cloud.Testbench doesn't read the root package's
dont-discover, sotestbench.yamlrepeats the list for the workbench.[^1][^1]: Tests already turn off package discovery (Testbench's default
['*']), so the new test checks the provider's registration directly.Evidence
New test,
loads the Bref bridge only on Craft Cloud, and never its health check:On
5.x, the "on Craft Cloud" case fails. With this change,composer cipasses: Pint, PHPStan, and 5 tests.Package discovery in a simulated consumer project, where
craftcms/cloudis an installed dependency:Workbench
route:list:POST signed-upload-urlis listed.Related issues