You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pretext: It is discouraged to cache config in development.
cache is stored in bootstrap/cache/ although it is git ignored
You might run into trouble if you have cached the config. Ref:#20719 Comment
Scenario: Might want to make docker image locally and have accidentally cache the config
Steps:
have .env with correct key in place (eg. new laravel proj)
php artisan config:cache
remove the key from APP_KEY (eg. replacing .env with something .env.backup)
php artisan key:generate
will say Application key set successfully but it isn't actually set in the .env file it is in the cached file
Issue: Key Replacement pattern looks for the earlier set app.key to replace which is currently not in the .env
protectedfunctionkeyReplacementPattern()
{
// here the $this->laravel['config']['app.key'] has the older cached key which it is tryna replace in .env$escaped = preg_quote('='.$this->laravel['config']['app.key'], '/');
return"/^APP_KEY{$escaped}/m";
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pretext: It is discouraged to cache config in development.
cache is stored in bootstrap/cache/ although it is git ignored
You might run into trouble if you have cached the config.
Ref: #20719
Comment
Scenario: Might want to make docker image locally and have accidentally cache the config
Steps:
php artisan config:cache
php artisan key:generate
Issue: Key Replacement pattern looks for the earlier set app.key to replace which is currently not in the .env
framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php
Line 107 in 37ba32d
Source
Possible Solutions:
php artisan optimize:clear
then generate the keyIf in docker's perspective add bootstrap/cache to your .dockerignore
Thank You
Beta Was this translation helpful? Give feedback.
All reactions