Skip to main content

Secrets Provider

For secure secret management, use the SecretsProvider packages available in R and Python. These packages allow you to store secrets in a separate .env file. Make sure to never commit this .env file to your Git repository. Use SecretsProvider to retrieve these secrets within cells that are not containerized. Containerized cells will not have access to the .env file, so you will need to fill in your secrets as parameters manually when running the workflow. Prefix all secret variable names with _secret (e.g., _secret_api_key) to prevent their values from being saved to the catalog. For python Consult the SecretsProvider documentation via help(SecretsProvider) for detailed usage instructions. For R, see the reference manual.

Python example:

# DO NOT CONTAINERISE
from SecretsProvider import SecretsProvider
# Set a secret
secret_API_key = SecretsProvider().set_secret("secret_API_key")
# Get a secret, or set and get the secret if it does not exist
secret_API_key = SecretsProvider().get_secret("secret_API_key")

R example:

# DO NOT CONTAINERISE
library("SecretsProvider")
secretsProvider <- SecretsProvider()
# Set a secret
secret_API_key <- secretsProvider$set_secret("secret_API_key")
# Get a secret, or set and get the secret if it does not exist
secret_API_key <- secretsProvider$get_secret("secret_API_key")