git-vars - Manage GitLab Environment Variables with Ease
git-vars is a Python package that simplifies managing GitLab environment variables. It allows you to seamlessly synchronize environment variables between your local machine and GitLab projects. This streamlines your development workflow by ensuring consistency and eliminating the hassle of manual updates.
Installation
Install git-vars using pip:
pip install git-vars
Usage
git-vars offers three main subcommands: configure, pull, and push.
Pull
Use the pull command to retrieve environment variables from your GitLab project and store them in a local file.
git-vars pull -t <access_token> -r <repository_url> [options]
Options:
-s, --scope: (Optional) The scope of environment variables to pull. Valid options are project, group, or instance. If not provided, the scope from the .git-vars file will be used (defaults to project if not set in .git-vars).
-f, --file: (Optional) Path to the file where downloaded variables will be saved. Defaults to .env.
Push
Use the push command to update GitLab environment variables from a local file.
git-vars push -t <access_token> -r <repository_url> [options]
Options:
-s, --scope: (Optional) The scope of environment variables to pull. Valid options are project, group, or instance. If not provided, the scope from the .git-vars file will be used (defaults to project if not set in .git-vars).
-f, --file: Path to the file containing environment variables to push. Defaults to .env.
Configure
Use the configure command to create or update the .git-vars file with your GitLab access token and repository URL.
git-vars configure -t <access_token> -r <repository_url>
-t, --access-token: Your GitLab personal access token. This will be saved in the .git-vars file.
-r, --repository-url: The URL of your GitLab repository. This will be saved in the .git-vars file.
-s, --scope: The scope of environment variables to pull. Valid options are project (default), group, or instance. If not provided, defaults to project.
Example:
Pull project environment variables from your GitLab repository and save them to a file named my_env.txt:
git-vars pull -f my_env.txt
Push environment variables defined in local_env.env to your GitLab project's group environment variables:
git-vars push -s group -f local_env.env
Additional Notes
Make sure you have a personal access token with the necessary permissions created in your GitLab account.
Environment variables are stored in a standard .env file format on your local machine (configurable with -f or --file).
For detailed information on specific functionalities and error handling, refer to the source code within the package.
Metadata
Release files for git-vars 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| git_vars-0.0.6.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git_vars-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / git_vars-0.0.6.tar.gz
| Download URL | git_vars-0.0.6.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c897eda3e1c7c46ddba12aaa37dcb648b13a5f8eb7b0605d3491d1ff1901c80e
|
|
BLAKE2b-256 checksum How to use checksums |
29ee59bcb2dc309663e0a768138f2ee3fbf0b61af446816df8f983ace7033a9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|
Release files / git_vars-0.0.6-py3-none-any.whl
| Download URL | git_vars-0.0.6-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46affb8d29e627f9fea4d36c24c6928784bcf9a7c0ce707bbf7038fe6a40eb75
|
|
BLAKE2b-256 checksum How to use checksums |
e489ba37105d123add94d18ea011c33bf233a3877b29f80c40bb38989e1cab2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.5
|