Skip to main content

Django integration for the Bella Baxter secret management SDK

Project description

bella-baxter-django

Django integration for the Bella Baxter secrets management platform. Automatically loads secrets from Bella Baxter and makes them available throughout your Django app.

Installation

pip install bella-baxter-django

Quickstart

# settings.py
INSTALLED_APPS = [
    ...
    'bella_baxter_django',
]

BELLA_BAXTER_API_KEY = 'bax-...'
BELLA_BAXTER_URL = 'https://api.bella-baxter.io'  # optional, this is the default
# anywhere in your code
from bella_baxter_django import get_bella

client = get_bella()
secrets = client.get_all_secrets()
db_url = secrets.secrets['DATABASE_URL']

How it works

get_bella() returns a shared BaxterClient instance, initialised lazily on first call and cached for the lifetime of the process. Adding 'bella_baxter_django' to INSTALLED_APPS triggers eager initialisation at Django startup via BellaBaxterConfig.ready(), so the first request doesn't bear the connection cost.

Configuration

Setting Required Default Description
BELLA_BAXTER_API_KEY API key (bax-...)
BELLA_BAXTER_URL https://api.bella-baxter.io Base URL of the Baxter API

Using secrets in views

from django.http import JsonResponse
from bella_baxter_django import get_bella

def health(request):
    bella = get_bella()
    secrets = bella.get_all_secrets()
    return JsonResponse({'db': secrets.secrets.get('DATABASE_URL', 'not set')})

Using secrets in settings.py

# settings.py — bootstrap secrets before Django fully loads
import os
from bella_baxter import BaxterClient, BaxterClientOptions

_bella = BaxterClient(BaxterClientOptions(
    baxter_url=os.environ.get('BELLA_BAXTER_URL', 'https://api.bella-baxter.io'),
    api_key=os.environ['BELLA_BAXTER_API_KEY'],
))
_secrets = _bella.get_all_secrets().secrets

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'HOST': _secrets['DB_HOST'],
        'NAME': _secrets['DB_NAME'],
        'USER': _secrets['DB_USER'],
        'PASSWORD': _secrets['DB_PASSWORD'],
    }
}

Authentication

Generate an API key via the CLI or the Bella WebApp:

bella api-keys create --env production --name "Django Production"

Set it in your environment and reference it in settings.py:

export BELLA_BAXTER_API_KEY="bax-..."

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bella_baxter_django-0.1.1rc66.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bella_baxter_django-0.1.1rc66-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file bella_baxter_django-0.1.1rc66.tar.gz.

File metadata

  • Download URL: bella_baxter_django-0.1.1rc66.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bella_baxter_django-0.1.1rc66.tar.gz
Algorithm Hash digest
SHA256 1f5d142d82f8e5c3f545c97f4af8f6708cb1b34d291f655c61f06dcd610c5a2b
MD5 a267333c4f74b5c6be3e239ec7cc39d5
BLAKE2b-256 3b09f6d0a8839c5873d89a2b84287a66d047445793256e2f0d0407aa41b13b4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for bella_baxter_django-0.1.1rc66.tar.gz:

Publisher: publish.yml on Cosmic-Chimps/bella-baxter-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bella_baxter_django-0.1.1rc66-py3-none-any.whl.

File metadata

File hashes

Hashes for bella_baxter_django-0.1.1rc66-py3-none-any.whl
Algorithm Hash digest
SHA256 2c0e57a8f5e5df572e4e47ea1062f5cdc379c6483318bc6febd35a446fc13804
MD5 79fcd3b69903e04038b06ca6a8e29c13
BLAKE2b-256 4d2b4d813f1aaf5a96bba893e7b88f38e0222c5cb4f67054bae844ae8ef93d11

See more details on using hashes here.

Provenance

The following attestation bundles were made for bella_baxter_django-0.1.1rc66-py3-none-any.whl:

Publisher: publish.yml on Cosmic-Chimps/bella-baxter-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page