Jump into your favourite repository folder and GitLab env. variables are automatically loaded into your shell. This tool in combination with direnv will export you project's env. variables from GitLab.
First, I have to say the glenv requires direnv installed.
Let's imagine we have clonned the hello/project repository into some folder.
$ clone git git@gitlab.com:glenv-demo/hello/demo.git
Let's jump into cloned demo folder.
$ cd ~/demo
direnv: loading ~/demo/.envrc
direnv: export +CI_PROJECT_ID +DEMO_ENV ...
The direnv automatically inject all env. variables from GitLab into my shell.
When I jump-out from this folder:
$ cd ..
direnv: unloading
The direnv automatically unload all GitLab env. variables.
The glenv is currently available as binary archive. You can download archive
here in GitHub releases.
Installation is simple anyway. Download the desired archive for your system,
unpack it and place it in some folder, which is in your PATH.
No need to configure it. Only GITLAB_TOKEN variable need to be present in your
environment.
If you don't have .envrc in your repository directory, call the command:
$ glenv init
The command create .envrc file for you. Now you can allow the directory
$ direnv allow .
enjoy :-)