Could someone help explain how EnvVarSecrets work ...
# prefect-community
m
Could someone help explain how EnvVarSecrets work with Docker storage? I'm registering my flow against a local prefect server and have a docker agent scheduling it successfully, but I can't seem to get environment variables to be in scope no matter what I do. I've tried setting the env variables in the shell that runs
prefect server start
, the one that runs
prefect agent docker
, and the one that runs the script that registers the flow, all with no luck
c
Hi @Matt Allen -
EnvVarSecret
will look to the current OS process running your Flow, which in your case will be the docker container. To set an environment variable on your container, you have essentially two options: - bake the environment variable into the container (using e.g., a Dockerfile); this of course is not very secure and obviates the need for a secret - use the
-e
flag on your agent to inform the agent to pass along certain env vars to the images it submits (e..g,
prefect agent start -e ENV_VAR1=$ENV_VAR1
)
m
Aha, that flag is what I was missing. Thanks!
c
👍 anytime!