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

Environment Not Allowed #184

Open
vesper8 opened this issue Oct 11, 2021 · 3 comments
Open

Environment Not Allowed #184

vesper8 opened this issue Oct 11, 2021 · 3 comments
Labels
bug Something isn't working Reviewed v5 version 5, supports both API and self hosted

Comments

@vesper8
Copy link

vesper8 commented Oct 11, 2021

I noticed today that in production, if I try to run php artisan route:list from the CLI I get the error "Environment Not Allowed"

I've read #166

And I understand why I'm getting the error, adding production to your package's config file makes this error go away.

However I feel like this is a bug? I should be able to disable your Mail Editor package in production without it interfering with other parts of Laravel?

It seems to me like the only way to be able to run a basic CLI command such as php artisan route:list in production right now is to either uninstall your package or allow it in production.

I have a feeling this is not what you intended.

@vesper8 vesper8 added bug Something isn't working Review Needed labels Oct 11, 2021
@ReeceM
Copy link
Collaborator

ReeceM commented Oct 11, 2021

Hi there @vesper8, thank you for opening the issue and for noticing this. (I haven't noticed this personally as I haven't run route:list in production with this package.)

I will take a look at this as this isn't the intended behavior as you state, it should be that the controllers are responding to actual requests and provide the routes.

If for the interim you are happy to install the package as a dev requirement it would be possible to have it excluded when running the composer install command for production instances. I don't think that should cause any issues as the package isn't directly injecting anything that would be needed in production...

@vesper8
Copy link
Author

vesper8 commented Oct 11, 2021

Thank you @ReeceM,

For now I'm ok with just enabling it on production. I'm glad it's on your radar now and hope it isn't too difficult to fix.

On a side note, but not totally unrelated, I just tried to visit /maileclipse on production and receive this error

Class 'Faker\Factory' not found

It stems from this line https://github.com/Qoraiche/laravel-mail-editor/blob/master/src/MailEclipse.php#L571

I suppose it's normal and not really a bug.. unsure if it's intended that Faker need to be installed in order for your package to function though. Anyone trying to access it in production would likely run into this issue.

@ReeceM
Copy link
Collaborator

ReeceM commented Oct 21, 2021

Hi @vesper8,

Sorry for coming back to you late on this, I tested and can confirm the above issues that you mention.

I am looking at the most practical and user intuitive way of allowing / disallowing the functionality by environment. e.g. by loading the Service Provider only in certain env.

With the Faker\Factory class not being found in production, because most composer.json files will require this as a require-dev dependency it doesn't get installed on production environments by default. And it probably shouldn't as it is a massive file anyways.

Will revert back once I have had a minute to look again at this.

@Qoraiche Qoraiche added the v5 version 5, supports both API and self hosted label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Reviewed v5 version 5, supports both API and self hosted
Projects
None yet
Development

No branches or pull requests

3 participants