Variables

Last updated

As you promote your application through test, UAT, staging and production, there are going to be differences in database connection strings, application settings, web service URLs, and many other parameters.

To make it easy to support different environments without hard-coding these configuration values, you can define variables related to your project. These variables are used during your application deployment. For example, variables you define will be automatically substituted into XML configuration files, and made available to your PowerShell scripts. This allows you to create applications and deployment scripts that are agnostic of the target environment.

Variables are essentially name/value pairs with optional scope rules applied. You can edit the variables using the Variables tab within a project.

Variables are an important and useful concept in Octopus, so this section describes different ways in which variables can be used.

Scoping variables Variables can have different values depending on the environment or machine that they target
Binding syntax Variables can be referenced throughout Octopus
Library variable sets Library variable sets let you re-use variables and variable templates between projects
Prompted variables Sometimes the value of a variable changes for each deployment. You can prompt for a variable value when scheduling a deployment.
Sensitive variables Octopus can securely store sensitive values, like passwords and API keys
System variables Many built-in variables are available within Octopus, such as the current environment name
Output variables Output variables let you programmatically set variables during a deployment, and then use those values in subsequent steps
Variable templates Variable template let you define variables that are required by your project, but where the values are provided by something else, like a tenant

In This Section

The following topics are explained further in this section: