Target environments with VIP-CLI commands
An application on VIP can include one or more environments, and users may have access to more than one application hosted on VIP. A VIP-CLI command can only be run against one environment at a time, so both an application and an environment type must be specified in a VIP-CLI command.
Prerequisite
- VIP-CLI is installed and has been updated to the most current version.
- To run a VIP-CLI command against an application’s environment, a user must have an App write role or greater for that application.
A user can determine which applications are available to them with the vip app list
command. For example:
$ vip app list ┌──────┬─────────────────┬─────────────────────────────────┐ │ id │ name │ repo │ ├──────┼─────────────────┼─────────────────────────────────┤ │ 4325 │ mytestmultisite │ wpcomvip/my-org-mytestmultisite │ ├──────┼─────────────────┼─────────────────────────────────┤ │ 4323 │ mytestsite │ wpcomvip/my-org-mytestsite │ └──────┴─────────────────┴─────────────────────────────────┘
The output returned by the vip app list
command includes the application ID (id
), the application alias (name
), and the GitHub repository (repo
).
An application can include one or more environments; typically Production, Preprod, and Develop. A user can list the environments that are available for an application with the vip app [ID]
command. Using the application ID 4323
from the example output above, the command vip app 4323
reports that the application includes a production
and a preprod
environment:
$ vip app 4323 =================================== + id: 4323 + name: mytestsite + repo: wpcomvip/my-org-mytestsite =================================== ┌──────┬────────┬────────────┬────────────┬─────────────┬────────────────┬───────────────────────────────┬──────────┐ │ id │ app id │ name │ type │ branch │ current commit │ primary domain │ launched │ ├──────┼────────┼────────────┼────────────┼─────────────┼────────────────┼───────────────────────────────┼──────────┤ │ 4323 │ 4323 │ production │ production │ production │ cb2784f │ mytestsite.go-vip.net │ false │ ├──────┼────────┼────────────┼────────────┼─────────────┼────────────────┼───────────────────────────────┼──────────┤ │ 4354 │ 4323 │ preprod │ preprod │ preprod │ cb2784f │ mytestsite-preprod.go-vip.net │ false │ └──────┴────────┴────────────┴────────────┴─────────────┴────────────────┴───────────────────────────────┴──────────┘
Application alias
A VIP-CLI command can be run with only the application’s alias specified: @<app-alias>
When a VIP-CLI command is run with this structure, a prompt will appear in the command line for the environment type to be specified.
To target the preprod
environment for an application with the alias mytestsite
:
$ vip @mytestsite -- wp option get home ? Which environment? … production ❯ preprod
The environment type can be specified within the VIP-CLI command by including the application’s alias, a dot separator, and the target environment type. For example: @<app-alias>.<env>
To target the preprod
environment for an application with the alias mytestsite
:
$ vip @mytestsite.preprod -- wp option get blog_public 1
Application ID
A VIP-CLI command can be run with only the application’s ID specified: @<app-ID>
When a VIP-CLI command is run with the @<app-ID>
structure, a prompt will appear in the command line for the environment type to be specified.
For example, to target the preprod
environment for an application with the ID 4323
:
$ vip @4323 -- wp option get blog_public ? Which environment? … production ❯ preprod
The environment type can be specified within the VIP-CLI command by including the application’s ID, a dot separator, and the target environment. For example: @<app-ID>.<env>
To target the preprod
environment for an application with the ID 4323
:
$ vip @4323.preprod -- wp option get blog_public 1
Last updated: April 28, 2023