x-6a-environment
Environment defines the variables and variable groups available to templates and security configuration. The environment object maps from the variable names (keys) to variable object that contains an optional description
key (a string describing the variable), and a value
string. When groups are used, variable objects may contain a set of keys value-{group}
depicting the value for each group of variables. When a group is selected but no value-{group}
is set, the content of value
should be used, otherwise an empty string is used.
Example JSON
This environment defines 2 variables (@userId
and clientId
) and 3 groups (local
, qa
, and prod
).
{
"x-6a-environment": {
"@userId": {
"description": "autovar from last call to login",
"value-local": "5",
"value-prod": "42",
"value-qa": "7"
},
"clientId": {
"value": "1",
"value-prod": "99"
}
}
}
These resolve as:
Group | Variables |
---|---|
local | @userId=5, clientId=1 |
qa | @userId=7, clientId=1 |
prod | @userId=42, clientId=99 |
Default Group
To configure a default group for an API (e.g. local
in the above example), set the x-6a-default-environment
within the info
section.
Field Name | Type | Description |
---|---|---|
x-6a-default-environment | string | The environment group name to automatically select. |
Server Groups
To associate a server with a group, set the, set the x-6a-group
value within each server in the servers
section.
Field Name | Type | Description |
---|---|---|
x-6a-group | string | The environment group name to associate with a server. |
Sensitive Variables
Sensitive variables are supported using the variable encryption definitions, and can be identified by the common prefix $ag2$v=6a
in the value string. The following apiKey
value of supersecret
is encrypted using the passphrase testing
.
{
"apiKey": {
"value": "$ag2$v=6a$iv=LpoVVoOKdEWOl3ea$qAjRne24MSDrxMq6Rtelt3gK$UqkgEoA2Wxr0vRhAtjUulsNlaJ2JWtREoKHB"
}
}