I was wondering why there is no production.php in config/environments ? How does Bedrock know what settings to use? Does it just use production as default? I know I can create custom environments etc., but just wasn’t able to dig out where to properly set, say WP_CACHE for production only?
I could set it in application.php, but that would use it everywhere?
Asking, because I’d like to set WP_CACHE to true for production to true.
On the side note: Noticed that WP-Optimize now has cache functionality from v3, but it puts WP_CACHE inside web/wp-config.php which should not be edited. It does work though. Any thoughts?
Hopefully I’m just missing something obvious, like application.php is a default dev/staging is just an override?
Things will be treated as production by default, which is why you can override with per environment configs.
If you want something only for production, just make
config/environments/production.php and add there.
WP_CACHE, I use WP Rocket which also adds this to
web/wp-config.php. I think this is fine since it gets readded each time I deploy with Trellis.
This way, the constant is only added on environments where WP Rocket is enabled.
Hope that helps!
Thanks @codepuncher, indeed that seems fine. Was wondering how you manage cache files with GIT ?
For example, there’s plenty of files edited/added when setting / testing cache locally:
- web/wp-config.php (WP_CACHE added)
- web/app/advanced-cache.php (all cache-ing plugins add this afaik)
Should any of these be in version control? I was thinking I would keep it as it is (not version control these) and enable the cache (which I’ll probably have to anyway?) manually on production etc.
What do you think? How do you approach it?
Right now I don’t version any of these files, and it seems it’s working as expected with WP-Optimize.
I personally don’t cache any of these files (or anything cache related) since these files need to be fresh and generated for each environment.
Also, some of these files may contain environment specific data (at least for my case with WP Rocket), so best to avoid storing in Git.
Note: this is just my approach. I haven’t seen or read any recommendations regarding this, so there may be a better approach.
Cool, I’m doing the same and it feels logical indeed. Cheers!
This topic was automatically closed after 42 days. New replies are no longer allowed.