The environment command
The environment command helps you work with environment configurations using Sitecore CLI. The command allows you to show information about the current environment, show a list of environments, and set your default environment.
Usage
The structure for the Sitecore CLI environment command is:
Or:
Subcommands
You can use the following subcommands:
current- displays the current environment.list- displays the environments from the user configuration file.set-default- sets an environment in user configuration file as the default environment.info- displays information about an environment.
The current subcommand
The current command displays the name of the current environment.
You can use the following options:
| Option | Description |
|---|---|
| -c | The path to the root sitecore.configdirectory.Default: current working directory. |
| ?, -h, --help | Help and usage information for the command. |
Assuming your current environment is named default, this command displays the name of the current environment (default):
The list subcommand
The list command shows all the environments defined in the configuration file.
You can use the following options:
| Option | Description |
|---|---|
| -c | The path to the root sitecore.config directory.Default: current working directory. |
| ?, -h, --help | Help and usage information for the command. |
For example, to see all the environments defined in the user.json file, run the following command:
The set-default subcommand
The set-default command sets an environment entry from the specified configuration as the default environment.
You can use the following options:
| Option | Description |
|---|---|
| -n | The named Sitecore environment to use. |
| -c | The path to the root sitecore.config directory.Default: current working directory. |
| -t, --trace | Report additional diagnostic and performance data. |
| -v, --verbose | Report additional diagnostic and performance data. |
| ?, -h, --help | Help and usage information for the command. |
For example, to set the myEnv environment as the default environment, run the following command:
The info subcommand
The info command displays information about a specified environment.
You can use the following options:
| Option | Description |
|---|---|
| -n | The named Sitecore environment to use. |
| -c | The path to the root sitecore.config directory.Default: current working directory. |
| -t, --trace | Report additional diagnostic and performance data. |
| -v, --verbose | Report additional diagnostic and performance data. |
| ?, -h, --help | Help and usage information for the command. |
For example, to see information about a Sitecore environment named myEnv, run the following command:
The response displays the name of the environment, the Content Management (CM) host URL, the version of the instance, and the installed version of Sitecore Management Services (SMS).