Documentation VIP Go VIP Go environments

VIP Go environments

Overview #

We refer to each instance of a VIP Go site as an environment, for example you have a production environment where your visitors access the site, a develop environment where you check code before deploying to production, and you have a local development environment. When your environments are running on VIP Go they will be using the same infrastructure as each other, so the caching control for a VIP Go staging environment is the same as for your VIP Go production environment (your local development environment is separate from the VIP Go infrastructure, but should share the application code).

↑ Top ↑

Environments #

Develop environment (optional, on request only)

Any code pushed to the develop branch will immediately be deployed here.

Staging environment

Any code pushed to the master branch will immediately be deployed here.

Production environment:

  • Pre-theme review, any code pushed to master branch will be immediately deployed here. More on the theme review process here.
  • Post-theme review, any code pushed to master branch will be deployed after VIP code review.

↑ Top ↑

Using VIP_GO_ENV to differentiate environments #

We provide the VIP_GO_ENV constant, which is populated with the name of the environment. This allows you to conditionally load code on a particular environment, or to avoid a particular environment.

Here’s an example of preventing code from running on production.

$disallowed_debug_envs = array(
    'production',
    'staging',
);
if ( ! in_array( VIP_GO_ENV, $disallowed_debug_envs, true ) ) {
    error_log( 'Some debugging information can go here and will never run on production or staging' );
}

Alternatively you can have code which only runs on production:

if ( 'production' === VIP_GO_ENV ) {
    // This code only runs on production, perhaps 
    // configuration for a live service
} else {
    // This code runs everywhere except production
}

For your local development environment, you may wish to set the VIP_GO_ENV constant in wp-config.php. If the VIP_GO_ENV constant is not set explicitly, the value will default to `false`.

Documentation is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.