Is there a better way to dynamically configure whi...
# prefect-community
Is there a better way to dynamically configure which
to read from? Our use case is that we have different key/value pairs depending on the lifecycle the Flow is being executed in, so we split that up into two different Secrets, and use a Parameter to trigger which lifecyle it should attempt to process:
Copy code
with Flow() as flow:
    lifecycle = Parameter("lifecycle", default='dev')
    secrets = PrefectSecret(f"SECRET_NAME_{}")
That seems hacky, to have to call
on the Parameter though. Wondering if anyone found a cleaner approach.
Depending on how often you use the secret, I've found that getting the secret inside a task can be really helpful for dynamic secrets. Something like this:
Copy code
def my_task(x):
  some_secret = Secret("SECRET_NAME_{x}").get()