Name | envvault JSON |
Version |
0.1.3
JSON |
| download |
home_page | None |
Summary | A tool to manage encrypted environment variables. |
upload_time | 2025-01-22 04:10:59 |
maintainer | None |
docs_url | None |
author | jin |
requires_python | <4.0,>3.9.1 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# EnvVault
EnvVault is a Python package for encrypting and managing `.env` files, similar to Rails Credentials. It allows you to securely store sensitive information (such as API keys, database passwords, etc.) and decrypt and use this information at runtime.
## Features
- **Encrypt `.env` files**: Encrypt plaintext `.env` files into `.env.enc` files.
- **Decrypt `.env.enc` files**: Decrypt `.env.enc` files at runtime and load environment variables.
- **Multi-environment support**: Create separate encrypted files for different environments (e.g., `development`, `production`).
- **Dynamic field support**: Automatically define fields in `Settings` based on the contents of `.env.enc`.
- **Type inference**: Automatically infer field types (e.g., `str`, `int`, `bool`) from environment variable values.
- **CLI tool**: Provides a command-line interface for managing encrypted files.
- **Integration with `pydantic_settings`**: Supports managing decrypted environment variables using `pydantic_settings`.
---
### **Dynamic Field Support**
EnvVault dynamically creates `Settings` fields based on the contents of the `.env.enc` file. For example, if your `.env.enc` file contains:
```yaml
API_KEY=your_api_key_here
DATABASE_URL=your_database_url_here
DEBUG=true
PORT=8080
```
EnvVault will automatically create the following fields in the `Settings` class:
- `API_KEY` (string)
- `DATABASE_URL` (string)
- `DEBUG` (boolean)
- `PORT` (integer)
---
### **Type Inference**
EnvVault supports automatic type inference for environment variables. For example:
- `DEBUG=true` → `DEBUG` is inferred as a boolean.
- `PORT=8080` → `PORT` is inferred as an integer.
- `API_KEY=your_api_key_here` → `API_KEY` is inferred as a string.
---
## Installation
Install using Poetry:
```bash
poetry add envvault
# Or install using pip:
pip install envvault
```
## Usage
### 1. Initialize
Initialize the `master key` and an empty `.env.enc` file:
```bash
envvault init --env development
```
This will generate the following files:
- `master.key`: The master key used for encryption and decryption.
- `.env.development.enc`: An empty encrypted file.
---
### 2. Edit Encrypted File
Edit the `.env.enc` file using your default editor:
```bash
envvault edit --env development
```
The editor will open a temporary file. After editing, the content will be re-encrypted and saved to `.env.development.enc`.
---
### 3. View Decrypted Environment Variables
Decrypt and view the contents of the `.env.enc` file:
```bash
envvault view --env development
```
Enter the following content in the editor:
```yaml
API_KEY=your_api_key_here
DATABASE_URL=your_database_url_here
DEBUG=true
PORT=8080
```
---
### 4. Use in Code
Load decrypted environment variables in your code:
```python
from envvault.settings import Settings
# Load configuration for the development environment
settings = Settings.from_credentials(env_name="development")
print("API Key:", settings.API_KEY)
print("Database URL:", settings.DATABASE_URL)
```
### or
```python
from envvault.settings import get_settings
# Load configuration for the current environment
envvault = get_settings()
print("API Key:", settings.API_KEY)
print("Database URL:", settings.DATABASE_URL)
```
---
## Configuration
### Default Editor
You can set the default editor using the `EDITOR` environment variable. For example:
```bash
export EDITOR=code # Use VS Code
export EDITOR=nano # Use Nano
export EDITOR=vim # Use Vim
```
---
### Multi-Environment Support
EnvVault supports creating separate encrypted files for different environments. For example:
- `.env.development.enc`: Development environment.
- `.env.production.enc`: Production environment.
Specify the environment name using the `--env` parameter in CLI commands.
---
## Contributing
Issues and Pull Requests are welcome!
---
## License
MIT
Raw data
{
"_id": null,
"home_page": null,
"name": "envvault",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>3.9.1",
"maintainer_email": null,
"keywords": null,
"author": "jin",
"author_email": "jin.xiaoming@ekohe.com",
"download_url": "https://files.pythonhosted.org/packages/d5/96/157c02a8b1167db2f481d66fe8e9e754f1b59cdf32edc9e98048df2f77f7/envvault-0.1.3.tar.gz",
"platform": null,
"description": "# EnvVault\n\nEnvVault is a Python package for encrypting and managing `.env` files, similar to Rails Credentials. It allows you to securely store sensitive information (such as API keys, database passwords, etc.) and decrypt and use this information at runtime.\n\n## Features\n\n- **Encrypt `.env` files**: Encrypt plaintext `.env` files into `.env.enc` files.\n- **Decrypt `.env.enc` files**: Decrypt `.env.enc` files at runtime and load environment variables.\n- **Multi-environment support**: Create separate encrypted files for different environments (e.g., `development`, `production`).\n- **Dynamic field support**: Automatically define fields in `Settings` based on the contents of `.env.enc`.\n- **Type inference**: Automatically infer field types (e.g., `str`, `int`, `bool`) from environment variable values.\n- **CLI tool**: Provides a command-line interface for managing encrypted files.\n- **Integration with `pydantic_settings`**: Supports managing decrypted environment variables using `pydantic_settings`.\n\n---\n\n### **Dynamic Field Support**\n\nEnvVault dynamically creates `Settings` fields based on the contents of the `.env.enc` file. For example, if your `.env.enc` file contains:\n\n```yaml\nAPI_KEY=your_api_key_here\nDATABASE_URL=your_database_url_here\nDEBUG=true\nPORT=8080\n```\n\nEnvVault will automatically create the following fields in the `Settings` class:\n\n- `API_KEY` (string)\n- `DATABASE_URL` (string)\n- `DEBUG` (boolean)\n- `PORT` (integer)\n\n---\n\n### **Type Inference**\n\nEnvVault supports automatic type inference for environment variables. For example:\n\n- `DEBUG=true` \u2192 `DEBUG` is inferred as a boolean.\n- `PORT=8080` \u2192 `PORT` is inferred as an integer.\n- `API_KEY=your_api_key_here` \u2192 `API_KEY` is inferred as a string.\n\n---\n\n## Installation\n\nInstall using Poetry:\n\n```bash\npoetry add envvault\n\n# Or install using pip:\npip install envvault\n```\n\n## Usage\n\n### 1. Initialize\n\nInitialize the `master key` and an empty `.env.enc` file:\n\n```bash\nenvvault init --env development\n```\n\nThis will generate the following files:\n- `master.key`: The master key used for encryption and decryption.\n- `.env.development.enc`: An empty encrypted file.\n\n---\n\n### 2. Edit Encrypted File\n\nEdit the `.env.enc` file using your default editor:\n\n```bash\nenvvault edit --env development\n```\n\nThe editor will open a temporary file. After editing, the content will be re-encrypted and saved to `.env.development.enc`.\n\n---\n\n### 3. View Decrypted Environment Variables\n\nDecrypt and view the contents of the `.env.enc` file:\n\n```bash\nenvvault view --env development\n```\n\nEnter the following content in the editor:\n\n```yaml\nAPI_KEY=your_api_key_here\nDATABASE_URL=your_database_url_here\nDEBUG=true\nPORT=8080\n```\n\n---\n\n### 4. Use in Code\n\nLoad decrypted environment variables in your code:\n\n```python\nfrom envvault.settings import Settings\n\n# Load configuration for the development environment\nsettings = Settings.from_credentials(env_name=\"development\")\nprint(\"API Key:\", settings.API_KEY)\nprint(\"Database URL:\", settings.DATABASE_URL)\n```\n\n### or\n\n```python\nfrom envvault.settings import get_settings\n\n# Load configuration for the current environment\nenvvault = get_settings()\nprint(\"API Key:\", settings.API_KEY)\nprint(\"Database URL:\", settings.DATABASE_URL)\n```\n\n---\n\n## Configuration\n\n### Default Editor\n\nYou can set the default editor using the `EDITOR` environment variable. For example:\n\n```bash\nexport EDITOR=code # Use VS Code\nexport EDITOR=nano # Use Nano\nexport EDITOR=vim # Use Vim\n```\n\n---\n\n### Multi-Environment Support\n\nEnvVault supports creating separate encrypted files for different environments. For example:\n\n- `.env.development.enc`: Development environment.\n- `.env.production.enc`: Production environment.\n\nSpecify the environment name using the `--env` parameter in CLI commands.\n\n---\n\n## Contributing\n\nIssues and Pull Requests are welcome!\n\n---\n\n## License\n\nMIT\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool to manage encrypted environment variables.",
"version": "0.1.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "35d3c95969d2cfb1ca02960d1e80421f353dea34cf3c00172fe7296442396119",
"md5": "d5065f98818adff45bbc43eb0e616834",
"sha256": "0ea1eb1406309993c3e89c4cd453cad1f9ed2edfde6f22ec790c4ec55c74277a"
},
"downloads": -1,
"filename": "envvault-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d5065f98818adff45bbc43eb0e616834",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>3.9.1",
"size": 5820,
"upload_time": "2025-01-22T04:10:57",
"upload_time_iso_8601": "2025-01-22T04:10:57.317328Z",
"url": "https://files.pythonhosted.org/packages/35/d3/c95969d2cfb1ca02960d1e80421f353dea34cf3c00172fe7296442396119/envvault-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d596157c02a8b1167db2f481d66fe8e9e754f1b59cdf32edc9e98048df2f77f7",
"md5": "199c191b629f1456d28c26cae3f97254",
"sha256": "2b169e135636a57bd1a01ae969949c0ca1e078b0766b36bc383fafe6b3699ac5"
},
"downloads": -1,
"filename": "envvault-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "199c191b629f1456d28c26cae3f97254",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>3.9.1",
"size": 4960,
"upload_time": "2025-01-22T04:10:59",
"upload_time_iso_8601": "2025-01-22T04:10:59.140108Z",
"url": "https://files.pythonhosted.org/packages/d5/96/157c02a8b1167db2f481d66fe8e9e754f1b59cdf32edc9e98048df2f77f7/envvault-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-22 04:10:59",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "envvault"
}