Skip to main content

Python SDK for Vaultarq - The developer-first, invisible secrets manager

Project description

Vaultarq

Python SDK for Vaultarq - The developer-first, invisible secrets manager

This SDK provides a seamless integration with Vaultarq for Python applications, automatically loading secrets from your Vaultarq vault into your application's environment variables.

Installation

pip install vaultarq

Requirements

  • Vaultarq CLI installed and initialized
  • Python 3.7 or higher

Usage

Basic Usage

from vaultarq import load_env

# Load secrets into os.environ
load_env()

# Now use secrets from os.environ
import os
print(os.environ["API_KEY"])

With Options

from vaultarq import load_env

# Load secrets with custom options
load_env(
    environment="prod",  # Load secrets from specific environment
    throw_if_not_found=True,  # Throw error if Vaultarq not found
    bin_path="/usr/local/bin/vaultarq"  # Custom path to Vaultarq binary
)

Checking Availability

from vaultarq import is_available, load_env

# Check if Vaultarq is available
if is_available():
    load_env()
else:
    print("Vaultarq not found, using fallback")
    # ... your fallback logic

With Flask Application

from flask import Flask
from vaultarq import load_env

# Load secrets before creating the Flask app
load_env()

app = Flask(__name__)

@app.route('/')
def home():
    import os
    return f"Connected to database: {os.environ.get('DB_NAME', 'unknown')}"

if __name__ == '__main__':
    app.run(debug=True)

With Django

In your settings.py:

import os
from vaultarq import load_env

# Load environment variables from Vaultarq
load_env()

# Use secrets in your Django settings
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY")
DEBUG = os.environ.get("DEBUG", "False").lower() == "true"

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': os.environ.get("DB_NAME"),
        'USER': os.environ.get("DB_USER"),
        'PASSWORD': os.environ.get("DB_PASSWORD"),
        'HOST': os.environ.get("DB_HOST", "localhost"),
        'PORT': os.environ.get("DB_PORT", "5432"),
    }
}

API

load_env(options)

Loads secrets from the Vaultarq vault into os.environ.

Parameters

Parameter Type Default Description
bin_path str 'vaultarq' Path to the Vaultarq executable
throw_if_not_found bool False Whether to throw an error if Vaultarq is not found
environment str Current linked env Environment to load secrets from
format str 'bash' Format to export secrets in ('bash', 'dotenv', or 'json')

Returns:

  • True if secrets were successfully loaded
  • False if loading failed (e.g., Vaultarq not installed)

is_available(bin_path='vaultarq')

Checks if Vaultarq is installed and accessible.

Returns True if Vaultarq is available, False otherwise.

License

MIT

Project details


Download files

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

Source Distribution

vaultarq-0.1.11.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

vaultarq-0.1.11-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file vaultarq-0.1.11.tar.gz.

File metadata

  • Download URL: vaultarq-0.1.11.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for vaultarq-0.1.11.tar.gz
Algorithm Hash digest
SHA256 a86da6f7e7c7d6c1de2fec3c54c9995285b0a033f91b27bdea8df6fd0233b4bc
MD5 05ee4fc7c415cc2807d4da565385491c
BLAKE2b-256 358345fa8b8a913a0501fa8be790edd4fefd4cf5c58167d7c32d7920359df9fe

See more details on using hashes here.

File details

Details for the file vaultarq-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: vaultarq-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for vaultarq-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 5a98ad1f27a7e3ac9de9fc192489aa3a2806a9d2757e4755c5df26d9b9c1cf25
MD5 18fa8ee708385007feddc8a1f6f8117d
BLAKE2b-256 38eb14dc3ec398b352b6db0376178e614d25c3fb1b94a6a47541bbdaa3a6ad81

See more details on using hashes here.

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