Environment variables

Alumio supports environment variables in configuration objects. Environment variables can be declared, to be used in configurations.

There are three types of environment variables:

  • Registry environment variables, provided by the system
  • User-defined environment variables
  • Encrypted user-defined environment variables

Registry variables can be overridden by a user defined variable with the same variable name.

Environment variables help solve the following:

  • Share variables between configurations
  • Leave sensitive data outside of configuration storage
  • Redact log messages holding sensitive information

Format

An environment variable is written as ${VARIABLE}, where VARIABLE may consist of uppercased alphanumeric characters (A-Z, 0-9) and underscore (_). The variable name must start with A-Z.

This format is explicitly incompatible with Symfony parameters and environment variables, to prevent the possibility of introducing injection vectors into the framework.

These environment variables resemble those of POSIX compliant systems, using the $VARIABLE syntax. The format resembles it, but is not the same, to allow easy interpretation of the following:

https://${BASE_URI}_V1/schema.json

Here, the variable is identified as ${BASE_URI}.

Without braces, this would be identified as $BASE_URI_V1, which would cause a mis-match and make the system skip on expansion of the variable.

Managing environment variables

All user defined environment variables are managed through the user interface.

When configuration uses undefined environment variables, the user interface will detect this and instruct the user to define the missing variables.

To manage the environment, the following actions are available:

Commands
Description Command
Generate a cryptography key environment:key:generate
Get a list of candidate environment variables environment:candidates
Get a list of all environment variables environment:variables
Get a variable by name environment:variables:name <name>
Create a new variable environment:variables:create
Update a variable environment:variables:name:update <name>
Delete a variable environment:variables:name:delete <name>
 
API routes
Description Route
Generate a cryptography key GET /api/v1/environment/key/generate
Get a list of candidate environment variables GET /api/v1/environment/candidates
Get a list of all environment variables GET /api/v1/environment/variables
Get a variable by name GET /api/v1/environment/variables/{name}
Create a new variable POST /api/v1/environment/variables
Update a variable PUT /api/v1/environment/variables/{name}
Delete a variable DELETE /api/v1/environment/{name}
 

Processing parameters

Given the following parameters:

{
"api": {
"base_uri": "https://${API_HOST}/",
"username": "${API_USER}",
"password": "${API_PASSWORD}"
}
}

Using the following environment variables:

Variable Value
${API_HOST} api.alumio.com
${APi_USER} admin
${APi_PASSWORD} secret123

The parameters after processing will be:

{
"api": {
"base_uri": "https://api.alumio.com/",
"username": "admin",
"password": "secret123"
}
}