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.

Source Distribution

config_templater-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file config_templater-0.1.1.tar.gz.

File metadata

  • Download URL: config_templater-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for config_templater-0.1.1.tar.gz
Algorithm Hash digest
SHA256 021abc1a66da54e354b53bdc32615e2c9b5dc7b5cbc4f481ddd6d79df8723fb8
MD5 25841619d12185b1348b861c488532bd
BLAKE2b-256 f63ee23ba3495e4be78b6b9112f1b42cdea18df6d1b86ffa9e888ef80ced5baf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page