https://prefect.io logo
Title
t

Tony Yun

08/09/2022, 4:08 PM
Hi, what is a way to pass local
.prefect/config.toml
file to runtime environment? For example, I’m writing
pytest
in VScode, when I run the test, it always fail for not finding the secrets that specified in that config file. I can only run in CLI
python flow.py
fine.
k

Khuyen Tran

08/09/2022, 4:15 PM
What kind of secrets you try to access from
.prefect/config.toml
?
t

Tony Yun

08/09/2022, 4:16 PM
AWS secret keys for example
k

Khuyen Tran

08/09/2022, 4:18 PM
We suggest that you use block to save your credentials in 2.0
t

Tony Yun

08/09/2022, 4:22 PM
no, I’m using 1.x version. Also, I’m trying to setup in local development runtime environment. Not in UI.
basically, when I run CLI
python flow.py
it is fetching the secrets fine. But when I run unit tests, it is not fetching the secrets even after I set the python setting to setup this environment variable
PREFECT__USER_CONFIG_PATH
k

Khuyen Tran

08/09/2022, 4:29 PM
@Mason Menges Maybe you know about this? I’m not very familiar with 1.0
👀 1
m

Mason Menges

08/09/2022, 4:56 PM
Hey @Tony Yun I'm having some trouble visualizing this in my head when you're referring to a local runtime environment are you just referring to a virtual environment on your local machine or a container image when the code is running?
t

Tony Yun

08/09/2022, 5:34 PM
a virtual environment on my local machine. I can do
export PREFECT__USER_CONFIG_PATH=~/.prefect/config
so if I run
python flow.py
it will fetch the secrets properly. How can I fetch the secrets too if I want to run an unit-test on VScode.
I’ve dumped
PREFECT__USER_CONFIG_PATH
as part of
os.environ
, however it didn’t help. so I wonder what’s the trick to load the Prefect secrets locally
actually pls ignore me. I have some issues that I have to fix first.
m

Mason Menges

08/09/2022, 5:49 PM
No worries, I was just trying to see if I could reproduce what you were experiencing 😄 Let us know if you get it sorted out.