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.
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.
Name of the environment.
Environment criticality (
Identifier of the last built container image. Designed to ensure same code version runs on all servers
Indicates whether the machine is the main Web server.
Host name of the Elasticsearch server.
Port to be used to connect to the Elasticsearch server.
Host name of the MySQL database of the environment.
Port to be used to connect to the MySQL database.
MySQL user login.
MySQL user password.
Name of the database.
Host name of the Redis server.
Port to be used to connect to the Redis server.
Environment variables defined at the environment level are available:
inside the containers
when custom callbacks are triggered (
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) (
echo 'My environment name is ' . $_ENV["ARTIFAKT_ENVIRONMENT_NAME"];