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:
dotnet sitecore.cli [options] environment [subcommand]
Or:
dotnet sitecore [options] env [subcommand]
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 |
---|---|
|
The path to the root Default: current working directory. |
|
Help and usage information for the command. |
Assuming your current environment is named default
, this command displays the name of the current environment (default
):
dotnet sitecore env current
The list subcommand
The list
command shows all the environments defined in the configuration file.
You can use the following options:
Option |
Description |
---|---|
|
The path to the root Default: current working directory. |
|
Help and usage information for the command. |
For example, to see all the environments defined in the user.json
file, run the following command:
dotnet sitecore env list
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 |
---|---|
|
The named Sitecore environment to use. |
|
The path to the root Default: current working directory. |
|
Report additional diagnostic and performance data. |
|
Report additional diagnostic and performance data. |
|
Help and usage information for the command. |
For example, to set the myEnv
environment as the default environment, run the following command:
dotnet sitecore env set-default myEnv
The info subcommand
The info
command displays information about a specified environment.
You can use the following options:
Option |
Description |
---|---|
|
The named Sitecore environment to use. |
|
The path to the root Default: current working directory. |
|
Report additional diagnostic and performance data. |
|
Report additional diagnostic and performance data. |
|
Help and usage information for the command. |
For example, to see information about a Sitecore environment named myEnv, run the following command:
dotnet sitecore env info -n myEnv
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).