https://prefect.io logo
Title
b

Brett Naul

08/09/2019, 2:09 AM
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

Chris White

08/09/2019, 2:12 AM
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:
prefect.context.secrets["MYSECRET"] = "VALUE"
you can also set secrets by env var, but the secret name must be all lowercase; e.g.
PREFECT__CONTEXT__SECRETS__MYSECRET=VALUE
will get converted to a secret with the name
mysecret
b

Brett Naul

08/09/2019, 4:06 PM
great, thanks! could be a good link to add to the Secrets doc page 😉
👍 1
c

Chris White

08/09/2019, 4:07 PM