{"id":21970710,"url":"https://github.com/appcelerator/envtpl","last_synced_at":"2026-05-01T00:31:15.289Z","repository":{"id":176688672,"uuid":"632027039","full_name":"appcelerator/envtpl","owner":"appcelerator","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-24T15:38:06.000Z","size":3325,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-22T22:43:50.853Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appcelerator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T14:57:08.000Z","updated_at":"2023-04-24T15:33:35.000Z","dependencies_parsed_at":"2024-02-06T05:45:28.900Z","dependency_job_id":null,"html_url":"https://github.com/appcelerator/envtpl","commit_stats":null,"previous_names":["appcelerator/envtpl"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/appcelerator/envtpl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Fenvtpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Fenvtpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Fenvtpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Fenvtpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appcelerator","download_url":"https://codeload.github.com/appcelerator/envtpl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator%2Fenvtpl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32481553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T14:41:59.082Z","updated_at":"2026-05-01T00:31:15.250Z","avatar_url":"https://github.com/appcelerator.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# envtpl\n\n`envtpl` renders [Go templates] on the command line using environment variables.\n\nIt is directly inspired by the original [envtpl], a Python tool for rendering\n[Jinja2] templates.\n\nThis port was motivated by the desire to add templating support for template-driven\nconfiguration files that needed to be part of a base Docker image without also\nrequiring the installation of Python. For the same reason, I decided not to add\nvariable support to my previous template utility [njx], which depends on Node.js.\n\nDespite the difference between `Jinja` and `Go` templates, an attempt was made\nto match the command line syntax of the original `envtpl`.\n\nThe biggest obvious difference is that `Go` template variables represent a path within\na data context, so `envtpl` variables will need to be prepended with a leading `.` to\nmatch the keys of the internal environment variable map object (see example).\n\n## Usage\n\n    envtpl [-o|--output outfile] [template]\n\n* If `template` is not provided, `envtpl` reads from `stdin`\n* If `outfile` is not provide, `envtpl` writes to `stdout`\n\n## Example\n\n`greeting.tpl`\n\n    Hello {{.USER}}\n\nRender the template (assume the value of `$USER` is 'mary')\n\n    envtpl greeting.tpl  # writes \"Hello mary\" to stdout\n\n    USER=bob envtpl greeting.tpl  # overrides \"mary\" and writes \"Hello bob\" to stdout\n\n    echo \"greetings {{.USER}}\" | envtpl  # writes \"greetings mary\" to stdout\n\n    envtpl \u003c greeting.tpl \u003e out.txt  # writes \"Hello mary\" to out.txt\n\n    cat greeting.tpl | envtpl \u003e out.txt  # writes \"Hello mary\" to out.txt\n\n`test/test.tpl` tests conditional functions as well as loop on environment variables. the `test/test/sh` script compares the output of envtpl with the expected output and can be used as unit test.\n\n## Template Functions\n\nIn addition to the [standard set of template actions and functions][standard-templates]\nthat come with Go, `envtpl` also incorporates [sprig] for additional, commonly used functions.\n\nFor example:\n\n    echo \"Greetings, {{.USER | title}}\" | envtpl  # writes \"Greetings, Mary\" to stdout\n\nIn the example, the environment name of the user `mary` is converted to `Mary` by the `title` template function.\n\n### Other functions\n\nTo mimic the environment function for the original envtpl, an `environment` function allows to filter the environment with a prefix string\n\n    {{ range $key, $value := environment \"TAG_\"  }}{{ $key }}=\"{{ $value }}\"{{ end }}\n\nfilters all environment variables starting with TAG_.\n\n## Building an envtpl executable\n\nThe `make.sh` script can be used to build the `envtpl` executable. If you provide\nthe `alpine` argument, it will build a binary for Alpine Linux. This build script\nis intended for Docker workflows; it does not require Go support, only Docker.\n\nTo build it for another system, export the GOOS and GOARCH environment variables.\n\n## Building an envtpl Docker image\n\n`build.sh` can be used to create an image for `envtpl` using the provided `Dockerfile`.\nIt copies the `envtpl` binary from the repo directory after building it with `make.sh`.\nBecause the `Dockerfile` is based on the `alpine` image, be sure to first build\nan executable for Alpine with the `alpine` option (`./build.sh alpine`).\n\n## Similar Tools\n\nAs mentioned above, this tool was inspired by the original [envtpl] project and\nmotivated to provide something similar without adding a Python dependency to\nDocker base images.\n\nA search for similar Go-based tools turns up the following:\n\n * [mattrobenolt/envtpl]\n * [arschles/envtpl]\n\nI haven't spent any time evaluating either yet. However, [mattrobenolt/envtpl] looks elegantly simple and [arschles/envtpl] offers tests, [glide] package management support and more template functionality using [sprig].\n\nNeither of these two packages appear to conform to the original `envtpl` command line syntax, which was one of my goals, although I don't think this is a big deal since all of these spin-off versions use an entirely different template syntax anyway. However, at first glance at least, this variant does offer more input/output options modeled after the original.\n\nI'm inspired by [arschles/envtpl] to add ~~[sprig] support for extended template functions~~, ~~potentially [glide] support~~, and definitely tests. This version now has [sprig] template support also (credit to [arschles/envtpl]) and uses glide for vendoring.\n\n## License\n\n[MIT](https://raw.githubusercontent.com/subfuzion/envtpl/master/LICENSE)\n\n\n[arschles/envtpl]:     https://github.com/arschles/envtpl\n[envtpl]:              https://github.com/andreasjansson/envtpl\n[glide]:               https://github.com/Masterminds/glide\n[Go templates]:        https://golang.org/pkg/text/template/\n[Jinja2]:              http://jinja.pocoo.org/docs/dev/\n[mattrobenolt/envtpl]: https://github.com/mattrobenolt/envtpl\n[njx]:                 https://github.com/subfuzion/njx\n[sprig]:               https://github.com/Masterminds/sprig\n[standard-templates]:  https://golang.org/pkg/text/template/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator%2Fenvtpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappcelerator%2Fenvtpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator%2Fenvtpl/lists"}