Skip to Content

Developers

Store secrets for Python metrics

Keep API keys and URLs out of your code, and read them in Python metrics.

Before you start

  • Your role has the Secrets Create permission. The default Editor and Developer roles have it. Every plan includes secrets.

Steps

  1. Go to Settings > Secrets.

  2. In the empty row at the bottom, enter the name, for example BASE_URL, and the Secret value. With no secrets yet, select Add secret first.

  3. Select Add.

    New secret row with name BASE_URL, a hidden value, the template {{ secrets_BASE_URL }} and the Add button highlighted.
    The row shows the name your code uses, {{ secrets_BASE_URL }}.
  4. Select Save secrets.

    Save bar with Discard and the Save secrets button highlighted.
    Nothing is stored until you save.

You see Saved 1 secret. The row shows the name your code uses, for example {{ secrets_BASE_URL }}. In Python, read it as secrets['secrets_BASE_URL']. See Build a metric with Python.

To add many at once, paste .env lines such as BASE_URL=https://api.example.com into the name field. Each line becomes a row.

Change or delete a secret

  • Change: select Edit, type a new value, then select Update. Leave the value empty to keep the old one.
  • Delete: select Delete and confirm. Code that uses the secret stops working at once. This cannot be undone.

Databrain encrypts each value and never shows it again. The table always shows ••••••••.

If something goes wrong

  • A secret with this name already exists. Pick a different name, or edit the existing secret.

On this page