Skip to main content

env-render

Render a file with jinja2 using a context built from processing environment variables.

Installation

From pip:

$ pip install env-render

Usage

To render a jinja document and collect all the environment variables with the prefix APP, enter this command:

$ env-render -p APP src_template.txt output.txt

Example

So imagine this environment:

APP_0_ENV0=a
APP_0_ENV1=b
APP_0_HOSTNAME=app_0
APP_1_ENV0=c
APP_1_ENV1=d
APP_1_HOSTNAME=app_1
APP_2_ENV0=e
APP_2_ENV1=f
APP_2_HOSTNAME=app_2

Becomes this dictionary:

{
    "apps": [
        {
            "_index": 0,
            "ENV0": "a",
            "ENV1": "b",
            "HOSTNAME": "app_0"
        },
        {
            "_index": 1,
            "ENV0": "c",
            "ENV1": "d",
            "HOSTNAME": "app_1"
        },
        {
            "_index": 2,
            "ENV0": "e",
            "ENV1": "f",
            "HOSTNAME": "app_2"
        }
    ]
}

Which can then be used like this in a file. Say an haproxy.cfg file:

listen someapp
    bind 0.0.0.0:80

    {% for app in apps %}
    server server{{ app._index }} {{ app.HOSTNAME }}:80
    {% endfor %}

This is what this library is meant to do.

Metadata

Release files for env-render 0.1.2

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

Source distribution (sdist)

Source distribution for env-render 0.1.2
File Size Uploaded Provenance
env-render-0.1.2.tar.gz 4.4 kB Without provenance Details

Release files / env-render-0.1.2.tar.gz

Download URL env-render-0.1.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f99643f9dc22846055d1b4de7a6a435da291646c7927cad788edf032bcf6c267
BLAKE2b-256 checksum
How to use checksums
c0a29818755eb173a7e87ffb6ad74aa984a60dac3abf99a3aec39998147df3c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for env-render 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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