Python - secret.version.access()
Retrieves the value from a version of a secret.
from nitric.resources import secretfrom nitric.application import Nitric# Get latest secret versionlatest = secret("database.password").allow("accessing").latest()# Access the latest secret versionvalue = await latest_version.access()Nitric.run()
Examples
Access the latest version of a secret
from nitric.resources import secretfrom nitric.application import Nitriclatest = secret("database.password").allow("accessing").latest()value = await latest.access()Nitric.run()
Access a specific version of a secret
from nitric.resources import secretfrom nitric.application import Nitrickey_ref = secret('apiKey').allow('accessing')key_value = await key_ref.version('the-version-id').access()Nitric.run()
Last updated on Dec 24, 2024