Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maksim-paskal/go-template
https://github.com/maksim-paskal/go-template
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/maksim-paskal/go-template
- Owner: maksim-paskal
- License: apache-2.0
- Created: 2020-06-24T09:23:36.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-18T22:50:02.000Z (about 1 year ago)
- Last Synced: 2024-06-21T09:49:31.202Z (7 months ago)
- Language: Go
- Size: 43.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Motivation
Modern dynamic infrastructure needs some config files that use environment variables, sometimes applications allow to use environment variable in configuration - some time no. This tool is single binnary application that pretty thin ~8Mb, its reduce docker image size, it's use golang templating engine for text processing# Example of usage
```bash
cat << EOF > /tmp/go-template-example
{{ env "TEST_ENV" }}
EOF# creates rendered file
cat /tmp/go-template-example | TEST_ENV=test go-template > /tmp/go-template-example.txt# check results
cat /tmp/go-template-example.txt# for example it can be used for render all files in directory with .template file extension
for file in $(find /etc/nginx/conf.d/ /etc/nginx -name *.template -type f)
do
dir=$(dirname $file)
name=$(basename $file .template)
cat $file | go-template > $dir/$name
done
```# Installation
MacOS
```bash
brew install maksim-paskal/tap/go-template
```
Linux
```bash
curl -L https://github.com/maksim-paskal/go-template/releases/download/v0.0.8/go-template-linux-amd64 -o /usr/local/bin/go-template
chmod +x /usr/local/bin/go-template
```
Dockerfile
```
ADD https://github.com/maksim-paskal/go-template/releases/download/v0.0.8/go-template-linux-amd64 /usr/local/bin/go-templateRUN chmod +x /usr/local/bin/go-template
```