Tom Smets
02/25/2025, 9:07 AMMarvin
02/25/2025, 9:07 AMprefect.yaml
file. Environment variables are useful for configuring settings or the runtime environment of a workflow. They take precedence over other sources, making them ideal for adjustments that should only apply to a single session or process.
To use an environment variable in your prefect.yaml
, you can reference it using the syntax ${ENV_VAR_NAME}
. This allows you to dynamically set values, such as the folder path for the pull_from_s3
step, based on your environment configuration.
For more details, you can refer to the Prefect documentation on settings and profiles and infrastructure concepts.Tom Smets
02/25/2025, 9:15 AMMarvin
02/25/2025, 9:16 AMbash
echo $YOUR_ENV_VAR
Replace YOUR_ENV_VAR
with the name of your variable.
2. Set the Environment Variable: If the variable isn't set, you can set it temporarily for the session using:
bash
export YOUR_ENV_VAR=value
This will make it available until you close the shell session.
3. Permanent Environment Variables: For a more permanent solution, add the export command to your shell's configuration file (e.g., .bashrc
, .bash_profile
, or .zshrc
):
bash
echo 'export YOUR_ENV_VAR=value' >> ~/.bashrc
Then, reload the configuration:
bash
source ~/.bashrc
4. Check for Typos: Ensure there are no typos in the variable name when you set it and when you reference it.
5. Environment File: If you're using a .env
file, make sure Prefect is running in a directory that contains the .env
file. Prefect will automatically apply settings from this file.
After following these steps, try printing the environment variables again to verify that your variable is set.