|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| .circleci/ | H | 25-Jan-2021 | - | 70 | 65 |
| .dependabot/ | H | 25-Jan-2021 | - | 10 | 8 |
| .github/ | H | 25-Jan-2021 | - | 250 | 224 |
| aws/ | H | 25-Jan-2021 | - | 1,022 | 810 |
| base64/ | H | 25-Jan-2021 | - | 67 | 51 |
| cmd/gomplate/ | H | 25-Jan-2021 | - | 28 | 16 |
| coll/ | H | 25-Jan-2021 | - | 1,171 | 998 |
| conv/ | H | 25-Jan-2021 | - | 701 | 577 |
| crypto/ | H | 25-Jan-2021 | - | 360 | 286 |
| data/ | H | 25-Jan-2021 | - | 4,354 | 3,639 |
| docs/ | H | 25-Jan-2021 | - | 11,115 | 8,286 |
| docs-src/content/functions/ | H | 25-Jan-2021 | - | 4,736 | 4,379 |
| env/ | H | 25-Jan-2021 | - | 193 | 142 |
| file/ | H | 25-Jan-2021 | - | 227 | 181 |
| funcs/ | H | 25-Jan-2021 | - | 4,432 | 3,370 |
| gcp/ | H | 25-Jan-2021 | - | 132 | 92 |
| hooks/ | H | 25-Jan-2021 | - | 83 | 63 |
| internal/ | H | 25-Jan-2021 | - | 7,195 | 5,982 |
| libkv/ | H | 25-Jan-2021 | - | 503 | 406 |
| math/ | H | 25-Jan-2021 | - | 78 | 59 |
| net/ | H | 25-Jan-2021 | - | 111 | 87 |
| random/ | H | 25-Jan-2021 | - | 240 | 188 |
| regexp/ | H | 25-Jan-2021 | - | 172 | 140 |
| strings/ | H | 25-Jan-2021 | - | 244 | 163 |
| test/ | H | 25-Jan-2021 | - | 93 | 68 |
| time/ | H | 25-Jan-2021 | - | 49 | 32 |
| tmpl/ | H | 25-Jan-2021 | - | 195 | 154 |
| vault/ | H | 25-Jan-2021 | - | 487 | 384 |
| vendor/ | H | 03-May-2022 | - | 17,907,336 | 12,604,260 |
| version/ | H | 25-Jan-2021 | - | 14 | 6 |
| .dockerignore | H A D | 25-Jan-2021 | 85 | 10 | 9 |
| .gitignore | H A D | 25-Jan-2021 | 49 | 8 | 7 |
| .golangci.yml | H A D | 25-Jan-2021 | 1.6 KiB | 86 | 83 |
| .imgbotconfig | H A D | 25-Jan-2021 | 85 | 5 | 4 |
| CHANGELOG.md | H A D | 25-Jan-2021 | 48.3 KiB | 674 | 453 |
| CONTRIBUTING.md | H A D | 25-Jan-2021 | 4.5 KiB | 62 | 43 |
| Dockerfile | H A D | 25-Jan-2021 | 3.1 KiB | 108 | 76 |
| Dockerfile.integration | H A D | 25-Jan-2021 | 419 | 18 | 11 |
| LICENSE | H A D | 25-Jan-2021 | 1.1 KiB | 22 | 17 |
| Makefile | H A D | 25-Jan-2021 | 7.3 KiB | 215 | 165 |
| README.md | H A D | 25-Jan-2021 | 6.4 KiB | 146 | 110 |
| cleanup.go | H A D | 25-Jan-2021 | 213 | 14 | 10 |
| config.go | H A D | 25-Jan-2021 | 3 KiB | 146 | 120 |
| config_test.go | H A D | 25-Jan-2021 | 793 | 49 | 38 |
| context.go | H A D | 25-Jan-2021 | 796 | 39 | 31 |
| context_test.go | H A D | 25-Jan-2021 | 1.5 KiB | 61 | 52 |
| funcs.go | H A D | 25-Jan-2021 | 1.5 KiB | 52 | 42 |
| go.mod | H A D | 25-Jan-2021 | 1.3 KiB | 38 | 35 |
| go.sum | H A D | 25-Jan-2021 | 89.6 KiB | 930 | 929 |
| gomplate.go | H A D | 25-Jan-2021 | 4.9 KiB | 224 | 189 |
| gomplate_test.go | H A D | 25-Jan-2021 | 7.1 KiB | 257 | 224 |
| metrics.go | H A D | 25-Jan-2021 | 883 | 25 | 16 |
| plugins.go | H A D | 25-Jan-2021 | 2.5 KiB | 118 | 93 |
| plugins_test.go | H A D | 25-Jan-2021 | 1.8 KiB | 77 | 67 |
| renovate.json | H A D | 25-Jan-2021 | 588 | 35 | 34 |
| template.go | H A D | 25-Jan-2021 | 7.2 KiB | 298 | 237 |
| template_test.go | H A D | 25-Jan-2021 | 7.1 KiB | 266 | 229 |
| template_unix.go | H A D | 25-Jan-2021 | 205 | 18 | 12 |
| template_unix_test.go | H A D | 25-Jan-2021 | 961 | 44 | 33 |
| template_windows.go | H A D | 25-Jan-2021 | 224 | 18 | 12 |
| template_windows_test.go | H A D | 25-Jan-2021 | 986 | 44 | 33 |
README.md
1<img src="docs/static/images/gomplate.png" width="512px" alt="gomplate logo"/>
2
3_Read the docs at [docs.gomplate.ca][docs-url], chat with developers and community in the [#gomplate channel][] on [Gophers Slack][]_
4
5[![Build Status][circleci-image]][circleci-url]
6[![Build][gh-actions-image]][gh-actions-url]
7[![Go Report Card][reportcard-image]][reportcard-url]
8[![Codebeat Status][codebeat-image]][codebeat-url]
9[![Coverage][gocover-image]][gocover-url]
10[![Total Downloads][gh-downloads-image]][gh-downloads-url]
11[![CII Best Practices][cii-bp-image]][cii-bp-url]
12
13[![hairyhenderson/gomplate on DockerHub][dockerhub-image]][dockerhub-url]
14[![DockerHub Stars][dockerhub-stars-image]][dockerhub-url]
15[![DockerHub Pulls][dockerhub-pulls-image]][dockerhub-url]
16[![DockerHub Image Layers][microbadger-layers-image]][microbadger-url]
17[![DockerHub Latest Version ][microbadger-version-image]][microbadger-url]
18[![DockerHub Latest Commit][microbadger-commit-image]][microbadger-url]
19
20[![Install Docs][install-docs-image]][install-docs-url]
21[![Slack][slack-image]][slack-url]
22[![Discussions][discussions-image]][discussions-url]
23
24`gomplate` is a template renderer which supports a growing list of datasources,
25such as: JSON (_including EJSON - encrypted JSON_), YAML, AWS EC2 metadata, [BoltDB](https://pkg.go.dev/go.etcd.io/bbolt),
26[Hashicorp Consul](https://www.consul.io/) and [Hashicorp Vault](https://www.vaultproject.io/) secrets.
27
28Come chat with developers and community in the [#gomplate channel][] on [Gophers Slack][] and on [GitHub Discussions][discussions-url]!
29
30Here are some hands-on examples of how `gomplate` works:
31
32```console
33$ # at its most basic, gomplate can be used with environment variables...
34$ echo 'Hello, {{ .Env.USER }}' | gomplate
35Hello, hairyhenderson
36
37$ # but that's kind of boring. gomplate has tons of functions to do useful stuff, too
38$ gomplate -i 'the answer is: {{ mul 6 7 }}'
39the answer is: 42
40
41$ # and, since gomplate uses Go's templating syntax, you can do fun things like:
42$ gomplate -i '{{ range seq 5 1 }}{{ . }} {{ if eq . 1 }}{{ "blastoff" | toUpper }}{{ end }}{{ end }}'
435 4 3 2 1 BLASTOFF
44
45$ # the real fun comes when you use datasources!
46$ cat ./config.yaml
47foo:
48 bar:
49 baz: qux
50$ gomplate -d config=./config.yaml -i 'the value we want is: {{ (datasource "config").foo.bar.baz }}'
51the value we want is: qux
52
53$ # datasources are defined by URLs, and gomplate is not limited to just file-based datasources:
54$ gomplate -d ip=https://ipinfo.io -i 'country code: {{ (ds "ip").country }}'
55country code: CA
56
57$ # standard input can be used as a datasource too:
58$ echo '{"cities":["London", "Johannesburg", "Windhoek"]}' | gomplate -d city=stdin:///in.json -i '{{ range (ds "city").cities }}{{.}}, {{end}}'
59London, Johannesburg, Windhoek,
60
61$ # and here's something a little more complicated:
62$ export CITIES='city: [London, Johannesburg, Windhoek]'
63$ cat in.tmpl
64{{ range $i, $city := (ds "cities").city -}}
65{{ add 1 $i }}: {{ include "weather" (print $city "?0") }}
66{{ end }}
67$ gomplate -d 'cities=env:///CITIES?type=application/yaml' -d 'weather=https://wttr.in/?0' -H 'weather=User-Agent: curl' -f in.tmpl
681: Weather report: London
69
70 \ / Partly cloudy
71 _ /"".-. 4-7 °C
72 \_( ). ↑ 20 km/h
73 /(___(__) 10 km
74 0.0 mm
75
762: Weather report: Johannesburg
77
78 \ / Partly cloudy
79 _ /"".-. 15 °C
80 \_( ). ↘ 0 km/h
81 /(___(__) 10 km
82 2.2 mm
83
843: Weather report: Windhoek
85
86 \ / Partly cloudy
87 _ /"".-. 20 °C
88 \_( ). ↑ 6 km/h
89 /(___(__) 20 km
90 0.0 mm
91```
92
93Read the documentation at [docs.gomplate.ca][docs-url], and join the discussion
94in [GitHub Discussions][discussions-url]!
95
96_Please report any bugs found in the [issue tracker](https://github.com/hairyhenderson/gomplate/issues/)._
97
98## License
99
100[The MIT License](http://opensource.org/licenses/MIT)
101
102Copyright (c) 2016-2021 Dave Henderson
103
104[circleci-image]: https://img.shields.io/circleci/project/github/hairyhenderson/gomplate/master.svg?logo=circleci
105[circleci-url]: https://circleci.com/gh/hairyhenderson/gomplate/tree/master
106
107[gh-actions-image]: https://github.com/hairyhenderson/gomplate/workflows/Build/badge.svg?branch=master
108[gh-actions-url]: https://github.com/hairyhenderson/gomplate/actions?workflow=Build&branch=master
109
110[reportcard-image]: https://goreportcard.com/badge/github.com/hairyhenderson/gomplate
111[reportcard-url]: https://goreportcard.com/report/github.com/hairyhenderson/gomplate
112[codebeat-image]: https://codebeat.co/badges/39ed2148-4b86-4d1e-8526-25f60e159ba1
113[codebeat-url]: https://codebeat.co/projects/github-com-hairyhenderson-gomplate
114[gocover-image]: https://gocover.io/_badge/github.com/hairyhenderson/gomplate
115[gocover-url]: https://gocover.io/github.com/hairyhenderson/gomplate
116[gh-downloads-image]: https://img.shields.io/github/downloads/hairyhenderson/gomplate/total.svg
117[gh-downloads-url]: https://github.com/hairyhenderson/gomplate/releases
118
119[cii-bp-image]: https://bestpractices.coreinfrastructure.org/projects/337/badge
120[cii-bp-url]: https://bestpractices.coreinfrastructure.org/projects/337
121
122[dockerhub-image]: https://img.shields.io/badge/docker-ready-blue.svg
123[dockerhub-url]: https://hub.docker.com/r/hairyhenderson/gomplate
124[dockerhub-stars-image]: https://img.shields.io/docker/stars/hairyhenderson/gomplate.svg
125[dockerhub-pulls-image]: https://img.shields.io/docker/pulls/hairyhenderson/gomplate.svg
126
127[microbadger-version-image]: https://images.microbadger.com/badges/version/hairyhenderson/gomplate.svg
128[microbadger-layers-image]: https://images.microbadger.com/badges/image/hairyhenderson/gomplate.svg
129[microbadger-commit-image]: https://images.microbadger.com/badges/commit/hairyhenderson/gomplate.svg
130[microbadger-url]: https://microbadger.com/image/hairyhenderson/gomplate
131
132[docs-url]: https://docs.gomplate.ca
133[install-docs-image]: https://img.shields.io/badge/install-docs-blue.svg
134[install-docs-url]: https://docs.gomplate.ca/installing
135
136[Gophers Slack]: https://invite.slack.golangbridge.org
137[#gomplate channel]: https://gophers.slack.com/messages/CGTR16RM2/
138
139[slack-image]: https://img.shields.io/badge/slack-gophers/%23gomplate-00ADD8.svg?logo=slack
140[slack-url]: https://gophers.slack.com/messages/CGTR16RM2/
141
142[discussions-image]: https://img.shields.io/badge/discussions-gomplate-blue.svg?logo=github
143[discussions-url]: https://github.com/hairyhenderson/gomplate/discussions
144
145[![Analytics](https://ga-beacon.appspot.com/UA-82637990-1/gomplate/README.md?pixel)](https://github.com/igrigorik/ga-beacon)
146