Environment Variables
Artifakt environment variables are available during application runtime. This allows you to customize an environments behavior or to use information you don’t want to save in your repository.
We know that an application must be able to run on several environments in parallel: development environments (on local or non-local machines), test environments, production environments, etc. If all these environments are based on the same source code, specific configurations are required for each of them. For example, the access credentials to your payment processor will be different between the test environments and your production.
This specific configuration must be stored in environment variables. Unlike other methods, such as configuration files, environment variables are unlikely to be accidentally revealed in your Git repository. In addition, this method allows you to change the configuration of each environment in isolation.
To add custom variables on an environment, go to Project → Settings → Application. The variables defined will be specific to this environment. Please note that the defined variables will be specific to the modified environment.

Configuring environment variables
An environment variable defined as "Masked" will not be displayed in the logs, unlike other environment variables.
In order to offer a high level of flexibility, Artifakt also allows you to define environment variables at the job level.
These variables are specific to the current job, which means that they will only be accessible in the execution context of this job.
In addition to the variables you define, Artifakt has a number of pre-defined variables built in. When adding new additional services (MySQL, Redis, ...) new variables are available.
The following variables are automatically set and available during build step and runtime. These variables cannot be overwritten.
Variable | Description |
ARTIFAKT_ENVIRONMENT_NAME | Name of the environment. |
ARTIFAKT_ENVIRONMENT_CRITICALITY | Environment criticality ( prod for a critical environment, dev for a noncritical environment ). |
ARTIFAKT_BUILD_ID | Identifier of the last built container image. Designed to ensure same code version runs on all servers |
ARTIFAKT_IS_MAIN_INSTANCE | Indicates whether the machine is the main Web server. |
Variable | Description |
ARTIFAKT_ES_HOST | Host name of the Elasticsearch server. |
ARTIFAKT_ES_PORT | Port to be used to connect to the Elasticsearch server. |
Variable | Description |
ARTIFAKT_MYSQL_HOST | Host name of the MySQL database of the environment. |
ARTIFAKT_MYSQL_PORT | Port to be used to connect to the MySQL database. |
ARTIFAKT_MYSQL_USER | MySQL user login. |
ARTIFAKT_MYSQL_PASSWORD | MySQL user password. |
ARTIFAKT_MYSQL_DATABASE_NAME | Name of the database. |
Variable | Description |
ARTIFAKT_REDIS_HOST | Host name of the Redis server. |
ARTIFAKT_REDIS_PORT | Port to be used to connect to the Redis server. |
Variable | Description |
ARTIFAKT_RABBITMQ_PROTOCOL | Protocol of RabbitMQ (AMQP or AMQPS) |
ARTIFAKT_RABBITMQ_HOST | Host or endpoint of RabbitMQ broker node |
ARTIFAKT_RABBITMQ_PORT | Port to be used to connect to the RabbitMQ service (default 5671 ). |
ARTIFAKT_RABBITMQ_USER | RabbitMQ default user login. |
ARTIFAKT_RABBITMQ_PASSWORD | RabbitMQ default user password. |
Environment variables defined at the environment level are available:
- inside the containers
- when custom callbacks are triggered (
build.sh
andentrypoint.sh
) - while executing any job
Environment variables defined at the job level are available:
- while executing the current job
- when custom callbacks are triggered (if any) (
build.sh
andentrypoint.sh
)
echo 'My environment name is ' . $_ENV["ARTIFAKT_ENVIRONMENT_NAME"];
echo $ARTIFAKT_ENVIRONMENT_NAME