Metadata-Version: 2.1
Name: jinja2-getenv-extension
Version: 1.0.1
Summary: a jinja2 extension to access to system environment variables
Home-page: https://github.com/metwork-framework/jinja2_getenv_extension
Author: Fabien MARTY
Author-email: fabien.marty@gmail.com
License: BSD
Keywords: jinja2 extension
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.0
Description-Content-Type: text/markdown
License-File: LICENSE

## What is it ?

This is a [jinja2](http://jinja.pocoo.org/) extension to access to system
environment variables. It is usefull if you have dynamically generated
variable names.

## Syntax

The syntax is `{% raw %}{{ 'ENV_VAR'|getenv }}{% endraw %}` to access to the `ENV_VAR` environment
variable. Don't forget the quotes around `ENV_VAR` !

If you want to provide a default value to avoid an exception if the corresponding
environment variable does not exist, you can use the following syntax:
`{% raw %}{{ 'ENV_VAR'|getenv('default_value') }}{% endraw %}`.

## Examples

```python

from jinja2 import Template, Environment

# We load the extension in a jinja2 Environment
env = Environment(extensions=["jinja2_getenv_extension.GetenvExtension"])

# For the example, we use a template from a simple string
template = env.from_string("the value of HOME environment variable is: "
                           "{% raw %}{{ 'HOME'|getenv }}{% endraw %}")
result = template.render()

# [...]
```


