Skip to main content

Config Templater

https://img.shields.io/pypi/v/config_templater.svg https://img.shields.io/travis/squ4rks/config_templater.svg Documentation Status

Simple python module to generate configurations from templates.

This is useful if you want to use configuration files for local development but want to use environment variables for deployment (i.e. in a container environment).

  • Free software: MIT license

Usage

You should run this script as a module. Executing in a directory will recursively parse the entire directory for .conftpl files and replace the jinja2 variables included with the corresponding environment variables.

Example

Given a configuration template file test.yml.conftpl like this:

---
access_token: "{{ API_ACCESS_TOKEN }}"
data_url: "{{ DATA_URL }}"

You can do the following to generate a configuration file:

# Set environment variables
$ export API_ACCESS_TOKEN="tdfkls0dkl1j313"
$ export DATA_URL="https://custome_domain.io/webhook"
$ python -m config_templater

This will generate the following configuration in test.yml

---
access_token: "tdfkls0dkl1j313"
data_url: "https://custome_domain.io/webhook"

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2019-12-10)

  • First release on PyPI.

Release files for config-templater 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for config-templater 0.1.1
File Size Uploaded
config_templater-0.1.1.tar.gz 5.5 kB Details

Release files / config_templater-0.1.1.tar.gz

Download URL config_templater-0.1.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
021abc1a66da54e354b53bdc32615e2c9b5dc7b5cbc4f481ddd6d79df8723fb8
BLAKE2b-256 checksum
How to use checksums
f63ee23ba3495e4be78b6b9112f1b42cdea18df6d1b86ffa9e888ef80ced5baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page