Environment Variables
Option 1: Activate from CLI (Command Line Interface)
The
exportkeyword is required so that the variable is available to child processes, such as scripts or applications launched from your shell.
Validate
Option 2: Activate Variables While Starting a Script
You can set a temporary environment variable just for the duration of a command
Sets team=ops only for the main.py process and any child processes that main.py spawns.
Option 3: Activate from .env file
- Create the
.envfile:
- Load the environment variables:
Using
exportin the.envfile ensures the variable is available to child processes.
Repository Security
To keep environment variables secure, ensure .env is ignored by version control:
This prevents accidentally committing sensitive information to your repository.