You can use environment variables in your manifest for entire or partial field values. The Forge CLI reads these values from the process environment when executing any command.
An environment variable must first be declared in environment.variables
before it can be used elsewhere in the manifest file:
1 2environment: variables: - VARIABLE - VARIABLE2
or using default values:
1 2environment: variables: - key: VARIABLE default: "default value" - key: VARIABLE2 default: "default value 2"
Note that environment variables are not presently supported for the forge build
command.
Property | Type | Required | Description |
---|---|---|---|
variables | Array of Variables | No |
A list of strings or objects, with the key each matching the regex |
Type | Required | Description |
---|---|---|
string | No |
A list of strings, each matching the regex |
{ key: string; default: string } | No |
A list of objects, the |
If you want to export your APP_ID
as just a list of environment variables without default values, you can:
1 2export APP_ID=406d303d-0393-4ec4-ad7c-1435be94583a
Afterwards, you can specify it in your manifest file:
1 2app: id: "ari:cloud:ecosystem::app/${APP_ID}" environment: variables: - APP_ID
Forge CLI commands that read the manifest will convert the variable APP_ID
as follows:
1 2app: id: "ari:cloud:ecosystem::app/406d303d-0393-4ec4-ad7c-1435be94583a" environment: variables: - APP_ID
Alternatively, if you want to export your APP_ID
as a list of environment variable objects, you can define your manifest file with a variable object that includes a default value:
1 2app: id: "ari:cloud:ecosystem::app/${APP_ID}" environment: variables: - key: APP_ID default: 406d303d-0393-4ec4-ad7c-1435be94583a
Forge CLI commands that read the manifest will convert the variable APP_ID
as follows:
1 2app: id: "ari:cloud:ecosystem::app/406d303d-0393-4ec4-ad7c-1435be94583a" environment: variables: - key: APP_ID default: 406d303d-0393-4ec4-ad7c-1435be94583a
Exported environment variables will always take precedence over the default
values defined in the manifest file.
Suppose you had exported the APP_ID
environment variable as follows:
1 2export APP_ID=12345678-1234-1234-1234-123456789012
Then, Forge CLI commands that read the manifest will convert the variable APP_ID
as follows:
1 2app: id: "ari:cloud:ecosystem::app/12345678-1234-1234-1234-123456789012" environment: variables: - key: APP_ID default: 406d303d-0393-4ec4-ad7c-1435be94583a
Rate this page: