-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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 encryption for non local environments fails since values are overloaded with env values from remote environment #44789
Comments
hey @joedixon thanks for the fix and the release. I just upgraded and it doesn't seem to fix the problem.
I made a simple test by dumping the config value I have the following
Results:
|
Ah! After some more tinkering I found out the problem was that we're checking for an existence of some keys in the Cache in the registering of a singleton in one of our service providers. So we are using the Cache facade in the register. It was only in one location so I moved it to a later point in the booting. However, i'm not sure if this should be documented or not? |
Hey @tomvo are you able to show me what that service provider looks like? |
hey @joedixon i can't really post the whole thing here but it basically boils down to this:
But as mentioned i've created a new I'm not that familiar with Laravel core but wouldn't it be possible to just encrypt any file without messing with environments at all. Something like |
Description:
When following the steps in the docs regarding .env encryption for non local environments here: https://laravel.com/docs/9.x/configuration#encrypting-environment-files the encryption fails since the ENV variables from the "to encrypt environment" are used.
In other words, i'm locally trying to encrypt the
.env
file that corresponds to our remote staging environment.env.staging
usingartisan env:encrypt --env=staging
. It obviously contains values for servers I cannot access locally like Redis, DB, etc. When trying to encrypt it fails on a timeout trying to connect to our staging Redis server becauseCACHE_DRIVER=redis
. When changing this value in.env.staging
toCACHE_DRIVER=array
the encryption works fine but it creates an encrypted .env.staging file with the wrong value forCACHE_DRIVER
.Steps To Reproduce:
.env.staging
file with values from a remote server with unreachable Redis instanceartisan env:encrypt --env=staging
The text was updated successfully, but these errors were encountered: