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

Allow Configuration Of Which Env Routes Should Not Publish For #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tcampbPPU
Copy link

The Problem

I am not able to adjust the added cypress routes based on environment (expect Production). When my APP_ENV is set to local or something like ci 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 environment APP_ENV set to production do the added Cypress routes not get published. To confirm this, you can change in your app:

APP_ENV=production

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 the exclude 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:

.env

APP_ENV=staging 

config/cypress.php

<?php
    'exclude' => 'production'
];

Small note, you would't need to add production here, just to simplify example.

Given the following example I would see the following routes added
image

Now if I update my config/cypress.php to include the staging environment too, then re-run command, I should not see the routes listed anymore.

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.

1 participant