Extract secrets from .env files into their own file (either `.secrets` or `secrets.json`). Also provides `mask` and `unmask` options. The resulting secrets file can be leveraged to get your secrets into a 3rd party secrets manager like AWS Secrets Manager or something else.
Project description
Env Wrangler
Overview
Extract secrets from .env files into their own file (either .secrets
or secrets.json
). Also provides mask
and unmask
options. The resulting secrets file can be leveraged to get your secrets into a 3rd party secrets manager like AWS Secrets Manager or something else.
Plays nice with cookiecutter-django.
Installation
python3 -m pip install env-wrangler
Usage
The path
parameter is a directory, not a file!
env-wrangler extract --path=".envs/.production"
# Only run if you've previously run extract
env-wrangler mask --path=".envs/.production"
env-wrangler unmask --path=".envs/.production"
NOTE: For help run
env-wrangler --help
or for a specific command runenv-wrangler {command} --help
.
Upon first run, env-wrangler
creates a ~/.env-wrangler/env-wrangler.cfg
file. You can modify this to add/remove key words based on your needs.
[default]
; Any environment variable that contains one of the following key words will be considered a secret
key_words = ACCESS_KEY, ACCESS_TOKEN, API_KEY, CLIENT_ID, CLIENT_SECRET, CONSUMER_KEY, CREDENTIALS, ENCRYPTION_KEY, HASH, JWT_SECRET, MASTER_KEY, OAUTH_TOKEN, PASSWORD, PRIVATE_KEY, SALT, SECRET, TOKEN, USER
; The env files that will be considered for extraction
envs = .env, .django, .postgres
Development
make env
make pip_install
make pip_install_editable
Testing
make pytest
make coverage
make open_coverage
TODO
- Add tests for cli commands
- Write secrets to file non-destructively (eg - add key if not there, remove key if no longer present)
Issues
If you experience any issues, please create an issue on Github.
History
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
0.0.1 (2024-04-15)
- First release
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
Built Distribution
Hashes for env_wrangler-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b76c4a78e33d12efcd0d975dad6dab440762df357f91516d612e215754a1c791 |
|
MD5 | 8ad669df003042385383121a2b515fed |
|
BLAKE2b-256 | a064bba9be2ee4c21ee09fc22863f069add9d45a5eb452ef9a069c3d06685b7c |