git-vars package

Managing Project and Group level Environment Variables

< >

Managing Project and Group level Environment Variables

Pulling Group Level Variables to Local .env.group

git-vars pull -s group -f .env.group

Pushing Local .env.group to GitLab Group Repository

git-vars push -s group -f .env.group

In this way, we can have project level and group level environment variables separated to not mix up things.

Here is an example in Python of how can .env.project and .env.group variables used in the code:

from environs import Env

# Initialize environs
env = Env()
env.read_env('.env.project')
env.read_env('.env.group')

# Access environment variables
database_url = env('DATABASE_URL')
api_key = env('API_KEY')
global_api_key = env('GLOBAL_API_KEY')
sentry_dsn = env('SENTRY_DSN')

print("DATABASE_URL:", database_url)
print("API_KEY:", api_key)
print("GLOBAL_API_KEY:", global_api_key)
print("SENTRY_DSN:", sentry_dsn)