Load docker secrets into ENV
Project description
docker-secrets-dotenv
docker-secrets-dotenv takes all your docker secrets files, and sets them up in the environment.
Getting Started
pip install docker-secrets-dotenv
To use docker-secrets-dotenv in your project run load_secrets
as the start of your application:
from docker_secrets import load_secrets
load_secrets()
# This will load all secret files found in /run/secrets into the running environment
load_secrets
will take the name of each secret file to set as the variable key and read the file contents as the value. It will overwrite existing environment variables.
There is an optional argument you can pass to remove the suffix of the secret when loading in the the environment:
from docker_secrets import load_secrets
load_secrets(remove_suffix="_FILE")
# This will load all secret files found in /run/secrets into the running environment
# after removing "_FILE" from the end of the secrets file name.
# /run/secrets/API_KEY_FILE will exist in the environment as API_KEY
This is mostly because I am lazy and don't want to update my existing secrets that follow the _FILE convention set by other docker images, or write my code in a way that checks for both variations with and without the suffix.
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
Hashes for docker_secrets_dotenv-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf59f2b6a89cc2fd7d0f879ff610d2cc77e7c13cf64f0682094211e6ed9e0905 |
|
MD5 | 08103bd25e9d71cd6373e5d3362e46c4 |
|
BLAKE2b-256 | f8329d2bbcab070c90700e2a0cddbffe825fcc48791e96ef5a79076ecafec686 |
Hashes for docker_secrets_dotenv-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eb9618f693d30db64a13f908fda3440b1bb94bd79ee149fe5bb6c1f7becfb09 |
|
MD5 | 05d179e0fa411f2d8b01474de4c4b325 |
|
BLAKE2b-256 | eaa3da4500d8aac110418002ee505f315943c4a2921f510b555844134dbe8327 |