[wp-trac] [WordPress Trac] #33161: Create a standard for defining and identifying site environment
WordPress Trac
noreply at wordpress.org
Wed Jul 29 07:51:12 UTC 2015
#33161: Create a standard for defining and identifying site environment
--------------------------------+------------------------------
Reporter: krogsgard | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 4.2
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------------+------------------------------
Comment (by Frank Klein):
You mention that Core does attempt to find out in what environment the
code is running, would you mind pointing me towards an example for this?
In my opinion, your code should not care where it runs. Local,
preproduction, production, those are just deploys of the same code base.
Meaning the behavior of the code base should not change depending on the
environment.
The current way of handling connection details in `wp-config.php`, and the
workarounds like the one that Mark has written about are fine for use
cases in which you do not want to put a deployment procedure into place.
However if you are at the point that you have a centralized development
version, a staging environment, etc. then the time for poor workarounds
like conditional handling of database connection information is gone.
There are solutions for all the problems that people encounter. There is
software to automatically provision machines in the different environments
to keep the stack the same. The config can be stored in environment
variables. Differences in asset handling (unminified in development,
minified in production) can be handled through build scripts.
There's a great site about best practices like this: http://12factor.net/
So in short I'm not in favor of this ticket. It encourages outdated
development techniques and actually makes things more difficult for
developers. Web development has moved on from these techniques, let's move
along with it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33161#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list