A library to maintain and use encrypted .env files.
Project description
Env Credentials
Manage environment variables use the dotenv pattern with encrypted files.
This project is an attempted port of the credentials pattern found in Ruby on Rails.
Installation
Using pip:
pip install env-credentials[django]
Using poetry:
poetry add env-credentials[django]
Usage
Initializing and editing the encrypted credentials file is only supported with Django at this time. Additional CLI tooling can be built for framework-less projects or projects using other frameworks.
Django
After adding the dependency to your project, add the Django app
INSTALLED_APPS = [
# ...
'django_credentials',
# ...
]
You can then initialize the credentials files with
./manage.py init_credentials
This will create a two new files called master.key
and credentials.env.enc
in your root folder. If a .gitignore
file exists in the same directory, it will also add master.key
to it.
Be sure to ignore your master.key file if the gitignore file cannot be automatically updated.
You can then edit the values in the file using
./manage.py edit_credentials
Be sure that your $EDITOR
environment variable is set, as that is what the decrypted file will be opened with.
Finally, to load the values into your environment, you should add the following code to your wsgi.py
and manage.py
files
from env_credentials.credentials import Credentials
Credentials().load()
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file env-credentials-0.1.0.tar.gz
.
File metadata
- Download URL: env-credentials-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.6.5 Linux/4.19.84-microsoft-standard
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d94056008b5b6e7f6ec93f11bdb96d6a7dc49f231a0f0c4b6015b2a979fade6 |
|
MD5 | 0d9918c38c01507f9dd58999b33d8335 |
|
BLAKE2b-256 | b7a910348592f7feba2a564fa5d523746d99d5006172d85b981e1ede3026dcf5 |
File details
Details for the file env_credentials-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: env_credentials-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.6.5 Linux/4.19.84-microsoft-standard
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c65b34c7fecf66387294ec773849beb7a14907af3ebb58a6f47cbd16d199b5a |
|
MD5 | c973ffbe9b8b7c176d2dfcee8cf4420c |
|
BLAKE2b-256 | f9519eac7ba09471094a129a5903048300f1eb3e4c72413e8d8b5891ac19106b |