https://prefect.io logo
Title
a

Amar Eid

02/23/2022, 4:09 PM
Hello everyone! I am very new to Prefect and have already started to build my new Flow.🙌 When trying to work with Prefect Secrets locally, using the following type of Secrets syntax in my local flow should run as well :
from prefect.tasks.secrets import PrefectSecret

@task
def my_task(secret_credentials):
    return secret_credentials

with Flow('test') as flow:
    credentials = PrefectSecret('NAME_OF_SECRET')
    my_task(credentials)
According to this documentation https://docs.prefect.io/orchestration/concepts/secrets.html#setting-local-secrets to be able to set these local secrets I have to 1. Create a custom config file by running:
cd ~/.prefect/ && touch config.toml
2. Add the local secrets into this file But the “.prefect” file doesnt exist on my machine. I have tried to uninstall and install prefect again and it doesnt generate. Any idea why this is happening and what I should do to create this file? Thanks in advance for the help! //fyi @Henrietta Salonen @Maximilian Lutz
k

Kevin Kho

02/23/2022, 4:12 PM
Hi @Amar Eid, you mean the
.prefect
doesn’t exist right? As long as you didn’t explicitly specify a home directory, you can create both the
.prefect
folder and the
config.toml
. I believe if you authenticate to Prefect Cloud, the
.prefect
folder should exist. It’s more common for
config.toml
not to, but you can just create it. The one that you make gets merged to the default one.
a

Amar Eid

02/23/2022, 4:25 PM
Thanks @Kevin Kho for your quick reply. I didnt authenticate to Prefect Cloud so that must be it. Ill do that and see if it works Thanks!!