Allow Configuration Of Which Env Routes Should Not Publish For #64
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.
The Problem
I am not able to adjust the added cypress routes based on environment (expect Production). When my
APP_ENV
is set tolocal
or something likeci
that is fine to have those routes added, but some workflows have several testing and qa environments where these routes might not be appropriate for.What Exist Now
Currently, as defined in the
CypressServiceProvider
only when in the parent application (i.e. the app using the package) has its application environmentAPP_ENV
set toproduction
do the added Cypress routes not get published. To confirm this, you can change in your app:Then run
php artisan route:list | grep cypress
to see no results.Alternatively you can have that set to local, or any other value and see a list of added cypress routes.
Solution
Within this PR I have added a feature that will now check if the application has a
config/cypress.php
file and if any application environment names are listed in theexclude
key, they will be treated similar to how production environment works now, and they will not be added.This also makes sure that the production environment is always added regardless of config,
Examples
Here I have an app which its
.env
&config/cypress.php
look like the following:Given the following example I would see the following routes added
Now if I update my
config/cypress.php
to include thestaging
environment too, then re-run command, I should not see the routes listed anymore.