Skip to content

[9.x] Prevents booting of providers when running env:encrypt#44758

Merged
taylorotwell merged 1 commit into
9.xfrom
fix/encrypt-command
Oct 27, 2022
Merged

[9.x] Prevents booting of providers when running env:encrypt#44758
taylorotwell merged 1 commit into
9.xfrom
fix/encrypt-command

Conversation

@joedixon

Copy link
Copy Markdown
Contributor

This PR resolves laravel/telescope#1262

When running env:encrypt with the --env option, the command is run as if in that environment and is booted using the associated environment file.

For example, php artisan env:encrypt --env=staging" runs the command using the environment variables from .env.staging`.

This can cause an issue if a service provider relies on a resource which is only accessible in that environment.

In the case of the issue above, it was Telescope attempting to register the Redis watcher for a cluster only accessible in the staging envrionment. Trying to run the command locally results in an exception being thrown.

To resolve the issue, I've prevented providers from booting when running the env:encrypt using the same approach as #44654

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.

Cannot use .env encrypt if telescope is enabled

2 participants