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

Update to use WP_ENVIRONMENT_TYPE #37

Open
bluestarstudios opened this issue Jan 15, 2021 · 7 comments
Open

Update to use WP_ENVIRONMENT_TYPE #37

bluestarstudios opened this issue Jan 15, 2021 · 7 comments
Assignees
Milestone

Comments

@bluestarstudios
Copy link

Hi!

LOVING this multi-environment config setup. It's truly fantastic, so thanks for sharing!

As you probably know, WordPress 5.5 introduced a new wp_get_environment_type() function.
https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-function-in-wordpress-5-5/

It would be great to update the code in the Multi-Environment config files to define WP_ENVIRONMENT_TYPE.

@RichForever
Copy link

@simonrjones any updates on this?

@simonrjones
Copy link
Member

hi - sorry for the delayed reply. This is a good idea & I will update the codebase to support this. This may be a breaking change, if so this will be released as 3.0

I am considering removing support for setting the environment dynamically based on the current hostname in wp-config.env.php. This should also resolve any issues with multiple hostnames (see #29 and #32).

Using environment variables, or using a local .env file, seems best practise to me so if I'm adding a breaking change encouraging this seems a good idea.

Any feedback appreciated.

@simonrjones simonrjones self-assigned this Aug 20, 2022
@simonrjones simonrjones modified the milestones: 3.0, 2.0.0 Aug 20, 2022
@bluestarstudios
Copy link
Author

@simonrjones thanks for looking into it.
You actually already have a suggested Pull request that will fix the multiple hostname issue #32.

If you were to remove the ability to dynamically set the environment, how would the environment have to be set? Via a 'define()'? And if that's the case, then how would this differ from the default standard wp-config.php?

@simonrjones
Copy link
Member

Thanks, I am about to test & merge that PR.

The core purpose for this repo is to load different config settings based on the current environments. A secondary purpose is setting the environment automatically based on hostname. It sounds like this secondary use case is really useful to you, is that correct?

I'm just taking this opportunity to review if that still makes sense or whether there are better practice ways this is done on WP projects. It may make sense to remain backward compatible and continue to support this.

I'm going to check with my team too on current usage & get feedback.

@newtlabs
Copy link
Contributor

Hi Simon, I'm using this on around 50 sites and it seems to work perfectly so if you want any feedback I'll be happy to help. I'm using the wp-config.env.php to set the hostname and I also add the .env file for live/staging..

@bluestarstudios
Copy link
Author

@simonrjones You're spot on. The primary purpose of the repo works like a charm and is the core reason I (and probably most of us) use it. But the secondary purpose (of automatically setting the environment based on the hostname) works extremely effectively, so I'm a huge fan of keeping it (as it seems @newtlabs is as well). I'm curious to hear what the team suggested in terms of future plans. Keep us posted!

@simonrjones
Copy link
Member

I'm testing the v3 release of this package, which includes support for WP_ENVIRONMENT_TYPE and some improved documentation.

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

No branches or pull requests

4 participants