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()
Release files for env-credentials 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| env-credentials-0.1.0.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| env_credentials-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / env-credentials-0.1.0.tar.gz
| Download URL | env-credentials-0.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d94056008b5b6e7f6ec93f11bdb96d6a7dc49f231a0f0c4b6015b2a979fade6
|
|
BLAKE2b-256 checksum How to use checksums |
b7a910348592f7feba2a564fa5d523746d99d5006172d85b981e1ede3026dcf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.6.5 Linux/4.19.84-microsoft-standard
|
Release files / env_credentials-0.1.0-py3-none-any.whl
| Download URL | env_credentials-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c65b34c7fecf66387294ec773849beb7a14907af3ebb58a6f47cbd16d199b5a
|
|
BLAKE2b-256 checksum How to use checksums |
f9519eac7ba09471094a129a5903048300f1eb3e4c72413e8d8b5891ac19106b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.6.5 Linux/4.19.84-microsoft-standard
|