Updated April 17, 2023
Introduction to GitLab Environment Variables
In GITLAB the environment level variables play a steady role. In GITLAB these environment variables can be defined and used in a very flexible manner. Some among the key instances where the environment level variables can be flexibly used are job controlling section, pipelines definition, more importantly a lot of work from the configuration file can be omitted and placed as default configuration variables. Definition and value storage can be successfully used by means of GITLAB CI/CD process. Other key advantages of environment variables are its capability to configure environment variables for testing, staging and production processes.
Supported Environment Variables
Some of the key variables supported are discussed below.
DATABASE_URL: This variable is of String Type and it is used for mentioning the url of the database which is been used.
Example:
$ if [ -z ${KUBERNETES_PORT+x} ]; then # collapsed multi-line command
$ export DATABASE_URL=”postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:5432/${POSTGRES_DB}”
$ cp -R . /tmp/app
$ /bin/herokuish buildpack test
ENABLE_BOOTSNAP: When the initial boot of the rails are placed then to speed up the booting process the ENABLE_BOOTSNAP variable can be used. The values 0 and 1 are used here were 1 is used for making the section to be enabled.
EXTERNAL_VALIDATION_SERVICE_TIMEOUT : This variable is of the integer format. So the input passed to these variables are of the integer format. Default value of this variable is 5 whereas Timeout value has to be mentioned here in seconds. The timeout value specified applies to CI/CD pipeline validation service.
EXTERNAL_VALIDATION_SERVICE_URL: This variable is of the String format. So, the input passed to these variables are of the string format. This field uses the url which has to be mentioned for any external CI/CD validation services if present.
GITLAB_CDN_HOST: This variable is of the String format. So, the input passed to these variables are of the string format. For all the server related assets this variable is usefully in setting up the base of the URL at a CDN level and aspect. So this basically sets the base of the URL in the server static level.
GITLAB_EMAIL_DISPLAY_NAME: This variable is of the String format. So, the input passed to these variables are of the string format. This environment variable is used for representing all the fields associated at a form level or related to the input form. Based on this URL gitlab forwards all its emails to the corresponding user.
GITLAB_EMAIL_FROM: This variable is of the String format. So, the input passed to these variables are of the string format. This environment variable is used for representing all the fields associated at a form level or related to the input form. Based on this URL gitlab forwards all its emails to the corresponding user. The difference between the GITLAB_EMAIL_DISPLAY_NAME from the GITLAB_EMAIL_FROM environment variables is in the what type if email value it refers. The GITLAB_EMAIL_FROM mentions the email field associated to all emails sent by the GITLAB.
GITLAB_EMAIL_TO: This variable is of the String format. So, the input passed to these variables are of the string format. This environment variable is used for representing all the fields associated at a form level or related to the input form. Based on this URL gitlab forwards all its emails to the corresponding user. The difference between the GITLAB_EMAIL_DISPLAY_NAME from the GITLAB_EMAIL_FROM environment variables is in the what type if email value it refers. The GITLAB_EMAIL_FROM mentions the email field associated to reply-to field of the GITLAB.
GITLAB_DATABASE_POOL: This environment variable corresponds to the number of pools associated to the database. The default value is 10 which mentions the basic number of data pools associated.
GITLAB_HOST: This holds the actual real host value, this means the value associated to the host in other words it can be mentioned as the complete URL of the GITLAB server which is been used.
GITLAB_ROOT_PASSWORD: Another string-based field which is corresponding to the root user. This means it is useful in setting the password of the root user associated to this GITLAB system.
GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN: From the runners perspective it associates to the initial token of registration associated to the runners. this is again a string field and takes input values as string.
RAILS_ENV: Mentions the type of rails environment used, it corresponds to the rails environment details like whether it is a Production environment or a development based environment or the environment is associated to staging or testing.
Complete database VARIABLES
GITLAB_DATABASE_ADAPTER: Mentions the type of database adapter which is been used. The default value of this is most probably PostgreSQL and it can be changed further from there on. The value in the database adapter can be overridden furtherly through the Database UTL.
GITLAB_DATABASE_ENCODING: Mentions the type of database Encoding which is been adapted. The default value of the field is UNICODE and it cannot be change further by means of Database URL.
GITLAB_DATABASE_PASSWORD: Mentions the Password associated to the GITLAB systems. The default value of this is None and it can again be changed further through the Database URL.
GITLAB_DATABASE_HOST: Mentions the Host involved in the database. This can be changed through the database variables value. The default value is the local host which mentions the host which is associated locally to the installed systems.
GITLAB_DATABASE_POOL: This environment variable corresponds to the number of pools associated to the database. The default value is 10 which mentions the basic number of data pools associated.
GITLAB_DATABASE_PORT: This environment variable corresponds to the port value 5432. This acts as the default value again and it can be overridden by the Database URL which is used.
GITLAB_DATABASE_USERNAME: This environment variable corresponds to the username used, this has the default value as root and the database URL here can be manipulated.
Conclusion
The article explains the role of database variables in GITLAB and also mentions on the various types of normal GITLAB variables and the database-oriented GITLAB variables involved.
Recommended Articles
This is a guide to GitLab Environment Variables. Here we discuss the Introduction, Key Supported Environment Variables for better understanding. You may also have a look at the following articles to learn more –