Closed sunaoka closed 1 year ago
First reaction is that config cache and other optimisations, should not happen during local dev. But on the other hand, one should be able to replicate full prod setup locally.
So that probably means we should be able to (optionally?) disable this behaviour locally. @tillkruss what's your feeling on this?
If needed, we could set an env variable in the -dev
images to signal it's a dev image.
Do you think there are other behaviors like these that we wouldn't want to reproduce when developing locally?
But on the other hand, one should be able to replicate full prod setup locally.
Oh, maybe one option is to enable/disable these behaviors based on the APP_ENV of Laravel? (and not based on the Docker image)
Oh, maybe one option is to enable/disable these behaviors based on the APP_ENV of Laravel? (and not based on the Docker image)
Yeah sounds good. Maybe even something like:
$shouldCache = env('BREF_LARAVEL_CACHE_CONFIG', env('APP_ENV') === 'production')
// or
$shouldCache = env('BREF_LARAVEL_CACHE_CONFIG', env('APP_ENV') !== 'local')
Sounds like an even better idea! (the second one sounds better I think because you could deploy "staging" environments for example)
Yeah, I'd agree that routes and the config doesn't need to be cached in dev
. You can also use App::environment('local')
for testing it, if needed @mnapoli.
Is there an update on this case?
$shouldCache = env('BREF_LARAVEL_CACHE_CONFIG', env('APP_ENV') ! == 'local')
Can I create a PR using the following?
@sunaoka hi! Yes feel free to create a PR!
Could there be an option to not run config:cache?
We are a development locally using
bref/php-*-fpm-dev:2
. Every time we change the.env
, we have to restart the docker container, which is very tedious.