Custom Environment Variables
You can define custom environment variables from the Squash admin interface.
Go to Settings -> Repositories
and then click on “Settings” for a given repository.
Each environment variable defined on this page will become available within the deployment host and docker containers.
Using environment variables defined in the web interface within the YAML file
You can use environment variables defined in the Squash web interface anywhere within the Squash YAML file.
You just need to prefix the variable name with a dollar (“$”) symbol to indicate to Squash that this is an environment variable.
For this example below we have previously defined a REGISTRY_PASSWORD in the Squash web interface:
deployments: MyApp: dockerimage: r.cfcr.io/bobkane/bobkane/myapp-repo:master docker_registry: server: r.cfcr.io username: bobkane password: $REGISTRY_PASSWORD
Defining environment variables in the YAML file
You may also define custom environment variables within the .squash.yml file.
Visibility of Environment Variables
All environment variables defined in the Squash interface above will be displayed in the beginning of the log output on the deployment loading page.
By default the actual value of each environment variable will be hidden in the log output, as long as the “Show in the deployment logs” field above is unchecked. Squash will still properly set the variable and its content/value in the application environment within the deployment.
This is a typical output of a custom environment variable with its value hidden (“Show in the deployment logs” field is unchecked):
Default Environment Variables
Squash automatically sets a number of environment variables during each deployment. These environment variables are made available on the deployment host server and within each docker container.
Squash will set these variables right before the
docker build or
docker-compose build process.
The full Squash deployment URL including the actual squash.io domain or the custom domain being used (if applicable) for the current deployment.
Or when using a custom domain:
This is the original branch name in GitHub including any special characters. Note that the original branch name will not always match the branch name that appears in the URL since Squash removes special characters that don’t fit within the URL schema.
This is the commit SHA-1 hash for the last commit retrieved in the current Squash deployment. Please note that when a deployment is retrieved with Persistent Storage Squash doesn’t automatically fetch the latest code, hence this information might not represent the actual last commit in the branch. See the Squash build process for more details.
This is the remaining component of all Squash deployment URLs excluding the domain name.
For this given deployment URL:
The value of SQUASH_BRANCH_WITH_ID will be: