are there any doc examples of using `Secret`s in p...
# ask-community
b
are there any doc examples of using `Secret`s in prefect core? the only page I could find just says vaguely what they are and that you could set them in the context, but not how to actually do so
c
Yea I guess this isn’t very well documented! Here is an example for setting a secret in your user config file: https://docs.prefect.io/guide/tutorials/slack-notifications.html#using-your-url-to-get-notifications to explicitly set a secret in context, simply:
Copy code
prefect.context.secrets["MYSECRET"] = "VALUE"
you can also set secrets by env var, but the secret name must be all lowercase; e.g.
Copy code
PREFECT__CONTEXT__SECRETS__MYSECRET=VALUE
will get converted to a secret with the name
mysecret
b
great, thanks! could be a good link to add to the Secrets doc page 😉
👍 1
c