https://github.com/malud/temgo
Environment variable based template engine like Jinja2 for your container config files. Lightweight, fast, go cli
https://github.com/malud/temgo
Last synced: about 1 year ago
JSON representation
Environment variable based template engine like Jinja2 for your container config files. Lightweight, fast, go cli
- Host: GitHub
- URL: https://github.com/malud/temgo
- Owner: malud
- License: mit
- Created: 2016-07-13T20:35:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T10:15:11.000Z (almost 6 years ago)
- Last Synced: 2025-03-31T03:12:11.584Z (about 1 year ago)
- Language: Go
- Size: 85 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# temgo [](https://travis-ci.org/malud/temgo)
Environment variable based template engine like Jinja2 for your container config files. Lightweight, fast, go cli
**Note:** wip
## Usage
Define variables with the format `{{ VAR_IABLE }}` inside your template files and set them in your environment before **tg** execution.
Currently with stdin/stdout and inline support.
```bash
# redirection
TESTVAR=foo tg < /opt/templates/file1.ext > /dest/config/file1.ext
# or inline
TESTVAR=foo tg -i /dest/config/file1.ext
```
However, using the inline option on your templates will overwrite them.
It is recommended to use this option on resettable files.
Placeholders which have no corresponding environment variable gets not replaced.
`echo 'foo {{ NOT_SET }} bar' | ./tg` results in `foo {{ NOT_SET }} bar`
In case of a required variable you can use the strict mode:
`echo 'foo {{ NOT_SET }} bar' | ./tg -s` results in an error.
### TODO
* flags for file in/out
* prefix flag for env var e.g. SERVICE_XXX
### License
MIT