Secrets Store
DataSpace offers the option to store secret tokens in a secure store.
Using secrets from a secret store instead of hardcoding them in your source code offers several advantages:
- Security: Secrets stored in the source code can be exposed to users with viewer access. The secret store keeps them encrypted and secure.
- Maintenance: Secrets change over time, such as API tokens or credentials. Updating them in a central secret store is easier than searching through the codebase to update them everywhere they’re used.
For example, instead of hardcoding an API token in your script like this:
auth_token = 'Bearer xxxx-yyyy-zzzz'You can create a new Secret in the Workspace settings panel
And access it securely from the environment
import osauth_token = f"Bearer {os.environ['AUTH_TOKEN']}"During the build, all secrets are injected as environment variables and can be accessed in Python by importing the os module.
