Skip to main content

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

Coverage

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 run env-wrangler {command} --help.

Upon first run, env-wrangler creates a ~/.env-wrangler/env-wrangler.toml file. You can modify this to add/remove key words based on your needs.

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.1.5 (2024-04-23)

  • Moved from configparser to toml for configuration.

0.1.4 (2024-04-19)

  • Bug fix when getting key from .env file for comparision

0.1.3 (2024-04-19)

  • Added ignore_keys to config for keys (exact key names) to always ignore even if they contain key_word.

0.1.2 (2024-04-18)

  • Bug fix for if a env value contains an "=". We only split on the first "=" so we get key,value from .env.

0.1.1 (2024-04-18)

  • Write secrets files non-destructively
  • Sort keys for secrets files

0.1.0 (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

env_wrangler-0.1.5.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

env_wrangler-0.1.5-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file env_wrangler-0.1.5.tar.gz.

File metadata

  • Download URL: env_wrangler-0.1.5.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.11

File hashes

Hashes for env_wrangler-0.1.5.tar.gz
Algorithm Hash digest
SHA256 785235dfff26358d39ff4179cc1171a9f2bd6310ed37e9dd46f16f18ce527bb1
MD5 9589a2e3545e0257936cabaa19e231f9
BLAKE2b-256 fb4d84e6406d8f719b38136157cbbd78be6dba78ac6a23256dd839afdf4b26ca

See more details on using hashes here.

File details

Details for the file env_wrangler-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for env_wrangler-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9bb27e6b8e15a27a15a09da8f501561d242eb14a5c2cdea710d157799cd2cda5
MD5 b0efd4d3d4ab3bbfc77f6e5630251e48
BLAKE2b-256 50d316d30a69e6f5189073bb2f9765f84a958420da6a1a2a3cc2970df66e4b26

See more details on using hashes here.

Supported by

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