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

Option to not run config:cache? #105

Closed
sunaoka opened this issue Mar 29, 2023 · 7 comments · Fixed by #128
Closed

Option to not run config:cache? #105

sunaoka opened this issue Mar 29, 2023 · 7 comments · Fixed by #128

Comments

@sunaoka
Copy link
Contributor

sunaoka commented Mar 29, 2023

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.

@georgeboot
Copy link
Contributor

georgeboot commented Mar 29, 2023

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?

@mnapoli
Copy link
Member

mnapoli commented Mar 29, 2023

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)

@georgeboot
Copy link
Contributor

georgeboot commented Mar 29, 2023

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')

@mnapoli
Copy link
Member

mnapoli commented Mar 29, 2023

Sounds like an even better idea! (the second one sounds better I think because you could deploy "staging" environments for example)

@tillkruss
Copy link
Member

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.

@sunaoka
Copy link
Contributor Author

sunaoka commented Aug 21, 2023

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?

@mnapoli
Copy link
Member

mnapoli commented Aug 21, 2023

@sunaoka hi! Yes feel free to create a PR!

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 a pull request may close this issue.

4 participants