Skip to main content

A tool to convert environment variables from ENV files to HashiCorp Vault Secret Engine format

Project description

Env-to-Vault

A tool to convert environment variables from ENV files to HashiCorp Vault Secret Engine format, with automatic key case conversion (uppercase to lowercase) and robust configuration management using Pydantic.

Features

  • 🔄 Convert ENV files to Vault Secret Engine format
  • 🔤 Automatic uppercase to lowercase key conversion
  • ⚙️ Robust configuration management with Pydantic
  • 🔐 Secure Vault integration with multiple authentication methods
  • 🛠️ Command-line interface with validation and dry-run modes

Installation

Prerequisites

  • Python 3.8+
  • HashiCorp Vault server/cloud
  • uv (recommended) or pip

Using uv (Recommended)

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone <repository-url>
cd env-to-vault

# Install dependencies
uv sync

# Install the package in development mode
uv pip install -e .

Using pip

pip install env-to-vault

Quick Start

  1. Create a configuration file (config.yaml):
vault:
  url: "http://localhost:8200"
  token: "your-vault-token"
  secret_engine: "secret"
  path_prefix: "env"

env_file:
  path: ".env"
  encoding: "utf-8"
  1. Run the conversion:
env-to-vault convert --config config.yaml

Configuration

Vault Configuration

  • url: Vault server URL
  • token: Vault authentication token
  • secret_engine: Secret engine name (default: "secret")
  • path_prefix: Path prefix for secrets in Vault

Environment File Configuration

  • path: Path to the ENV file
  • encoding: File encoding (default: "utf-8")

Usage Examples

Basic Conversion

# Convert .env file to Vault
env-to-vault convert --env-file .env --vault-url http://localhost:8200 --vault-token your-token

Using Configuration File

# Use configuration file
env-to-vault convert --config config.yaml

Validation Mode

# Validate configuration without making changes
env-to-vault validate --config config.yaml

Verbose Output

# Show detailed output
env-to-vault convert --config config.yaml --verbose

Development

Setup Development Environment

# Install development dependencies
uv sync --group dev

# Run tests
uv run pytest

# Run linting
uv run black src tests
uv run flake8 src tests

# Run type checking
uv run mypy src

Project Structure

env-to-vault/
├── src/
│   └── env_to_vault/
│       ├── __init__.py
│       ├── cli.py
│       ├── config.py
│       ├── parser.py
│       └── vault.py
├── tests/
├── examples/
├── pyproject.toml
└── README.md

License

MIT License - see LICENSE file for details.

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

env_to_vault-0.1.3.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

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

env_to_vault-0.1.3-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file env_to_vault-0.1.3.tar.gz.

File metadata

  • Download URL: env_to_vault-0.1.3.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.8

File hashes

Hashes for env_to_vault-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9ddacaf528264c4ee89d5ce9b2c420043b68d89aa2d4b9b6ebe0ac3080dec9b6
MD5 b0b09718a708f812f7e42d80fb1d77de
BLAKE2b-256 e12bd386bba434e3854f8b274595cd69da37d458da26a7a9e62b32b1adf857b0

See more details on using hashes here.

File details

Details for the file env_to_vault-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for env_to_vault-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0a271d456f05ebade0f4303f6153350090e861a1560dcb27eaeb2b5691606f39
MD5 83f20eee6f1f2d22663ca68a7c778b11
BLAKE2b-256 a7d2dff3468c6ea4e1be9b996caed8726390b15f2344465e78143da87a48567f

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