Extentsion to load vault screts in jinja templates
Project description
Jinja2 library for loading Vault screts
The idea behind this project is to allow dynamically loading vault secrets in applications like cookiecutter.
Installation
To install just run pip install jinja2-vault
Usage
Add the jinja2 secret function like this:
password={% secret "password", path="database", mount="app1/secret" %}
As simple python code to test is:
from jinja2 import Environment, Template
env = Environment(
extensions=['jinja2-vault.VaultExtension']
)
template = env.from_string('password={% secret "password", path="database", mount="app1/secret" %}')
result = template.render()
print(result)
Both examples load key password from app1/secret/database where app1/secret is the mount and database the path.
Setup for cookiecutter
Add the module to the cookiecutter.json.
Example:
{
"some_var": "var",
"_extensions": [
"jinja2-vault.VaultExtension"
]
}
The further usage the same as desribed in Usage.
Todo
[ ] Add some unit tests
Build
To build and push the package:
python setup.py sdist
python -m twine upload dist/*
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
File details
Details for the file jinja2-vault-0.0.3.tar.gz.
File metadata
- Download URL: jinja2-vault-0.0.3.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98f0212e0ec4985640b5772bf58941ca475a51ce6694d811a9e0734d300e466f
|
|
| MD5 |
ed2fcaa7173e738f5c69bd204640de20
|
|
| BLAKE2b-256 |
187d2c5aba0a03fc1003ad8818fa7373423e66af15a4ce37e502d2a1b4628d61
|