Skip to main content

Simple python module to generate configurations from templates

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for config-templater, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size config_templater-0.1.1.tar.gz (5.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page