{"id":14156157,"url":"https://github.com/bitnami/render-template","last_synced_at":"2025-08-06T02:31:55.438Z","repository":{"id":39996908,"uuid":"149101194","full_name":"bitnami/render-template","owner":"bitnami","description":"CLI tool for rendering templates with custom data","archived":false,"fork":false,"pushed_at":"2024-11-08T09:29:33.000Z","size":82,"stargazers_count":30,"open_issues_count":0,"forks_count":9,"subscribers_count":20,"default_branch":"main","last_synced_at":"2024-11-08T10:22:57.496Z","etag":null,"topics":["templates"],"latest_commit_sha":null,"homepage":"https://bitnami.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitnami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-17T09:28:25.000Z","updated_at":"2024-11-08T09:28:45.000Z","dependencies_parsed_at":"2023-02-10T16:16:07.137Z","dependency_job_id":"2aaaf8d4-cbe3-40a8-8356-0b45811bb881","html_url":"https://github.com/bitnami/render-template","commit_stats":{"total_commits":37,"total_committers":8,"mean_commits":4.625,"dds":0.7027027027027026,"last_synced_commit":"2e34931ca36094fe0bc43f7503fc2e84c53b15d3"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitnami%2Frender-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitnami%2Frender-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitnami%2Frender-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitnami%2Frender-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitnami","download_url":"https://codeload.github.com/bitnami/render-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228829058,"owners_count":17978144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["templates"],"created_at":"2024-08-17T08:05:15.361Z","updated_at":"2025-08-06T02:31:55.398Z","avatar_url":"https://github.com/bitnami.png","language":"Go","funding_links":[],"categories":["others","Go"],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/bitnami/render-template)](https://goreportcard.com/report/github.com/bitnami/render-template)\n[![CI](https://github.com/bitnami/render-template/actions/workflows/main.yml/badge.svg)](https://github.com/bitnami/render-template/actions/workflows/main.yml)\n\n# render-template\n\nThis tool allows rendering Handlebars 3.0 templates, using as context data the current environment variables or a provided data file.\n\n# Basic usage\n\n```console\n$ render-template --help\nUsage:\n  render-template [OPTIONS] [template-file]\n\nApplication Options:\n  -f, --data-file=DATA_FILE    Properties file containing the replacements for the template\n\nHelp Options:\n  -h, --help                   Show this help message\n\nArguments:\n  template-file:               File containing the template to render. Its contents can be also passed through stdin\n```\n\nThe tool supports rendering templates from a file or stdin (for convenience).\n\nThe source data is taken from the environment variables or a data file, with properties-file format (key=value, a line for each pair). When a variable is defined both as an environment variable and in the data file, the latter will take precedence.\n\n# Examples\n\n## Render data from a template file with environment variables\n\n```console\n# Create the template\n$ echo 'hello {{who}}' \u003e template.tpl\n# Render it without 'who' variable\n$ render-template template.tpl\nhello \n# Render it with 'who' variable defined\n$ who=bitnami render-template template.tpl\nhello bitnami\n```\n\n## Render data from stdin with environment variables\n\n```console\n$ log_file=/tmp/stout.log port=8080 pid_file=/tmp/my.pid render-template \u003c\u003c\"EOF\"\n# My service log file\nlog_file \"{{log_file}}\"\n\n# HTTP port\nport {{port}}\n\n# My service pid file\npid_file \"{{pid_file}}\"\nEOF\n```\n\nOutputs:\n\n```\n# My servide log file\nlog_file \"/tmp/stout.log\"\n\n# HTTP port\nport 8080\n\n# My service pid file\npid_file \"/tmp/my.pid\"\n```\n\n## Render data from stdin with data file\n\n```console\n# write data file\n$ cat \u003e data.properties \u003c\u003c\"EOF\"\nlog_file=/tmp/stout.log\nport=8080\npid_file=/tmp/my.pid \nEOF\n\n$ render-template --data-file ./data.properties \u003c\u003c\"EOF\"\n# My servide log file\nlog_file \"{{log_file}}\"\n\n# HTTP port\nport {{port}}\n\n# My service pid file\npid_file \"{{pid_file}}\"\nEOF\n```\n\nOutputs:\n\n```\n# My service log file\nlog_file \"/tmp/stout.log\"\n\n# HTTP port\nport 8080\n\n# My service pid file\npid_file \"/tmp/my.pid\"\n```\n\n## Overriding environment variables in a data file\n\n```console\n# Let's define some environment variables\n$ export name=foo\n$ export company=bar\n$ export year=3000\n\n# And write a template\n$ cat \u003e data.tpl \u003c\u003c\"EOF\"\n{{name}} works at {{company}}\nsince {{year}}\nEOF\n\n# Rendering from the environment would yield\n$ render-template data.tpl\nfoo works at bar\nsince 3000\n\n# But we can override it from a data file, either partially, to get a mix:\n\n$ echo \"name=mike\" \u003e data.properties\n$ render-template --data-file data.properties data.tpl\nmike works at bar\nsince 3000\n\n# Or completely:\n\n$ cat \u003e data.properties \u003c\u003c\"EOF\"\nname=mike\ncompany=Bitnami\nyear=2010\nEOF\n\n$ render-template --data-file data.properties data.tpl\nmike works at Bitnami\nsince 2010\n```\n\n## Using helpers\n\nThe tool supports all the standard handlebar helpers: https://handlebarsjs.com/builtin_helpers.html\n\n```console\n$ render-template \u003c\u003c\"EOF\" \n {{#if author}}\n{{firstName}} {{lastName}}\n {{else}}\nUnknown Author\n {{/if}}\nEOF\n\n# Which outputs\nUnknown Author\n\n$ author=me firsName=foo lastName=bar render-template \u003c\u003c\"EOF\" \n {{#if author}}\n{{firstName}} {{lastName}}\n {{else}}\nUnknown Author\n {{/if}}\nEOF\n\n# Outputs:\nfoo bar\n```\n\nIn addition, it includes a few custom helpers:\n\n### json_escape\n\nThe json_escape helper converts the  provided value into a valid JSON string\n```console\n$ export VALUE='this is \"a string\", with quoting\n\nand some line breaks'\n```\nWithout the helper:\n\n```console\n$ render-template \u003c\u003c\u003c'VALUE={{VALUE}}'\nVALUE=this is \"a string\", with quoting\n\nand some line breaks\n```\n\nUsing the helper:\n```console\n$ render-template \u003c\u003c\u003c'VALUE={{json_escape VALUE}}'\nVALUE=\"this is \\\"a string\\\", with quoting\\n\\nand some line breaks\"\n```\n\n### quote\n\nThe quote helper Quotes a string\n\nWithout the helper:\n```console\n$ ARG1=\"some arg\" ARG2=\"some other \\\"arg\\\"\" render-template \u003c\u003c\"EOF\"\nARG1={{ARG1}} ARG2={{ARG2}}\nEOF\nARG1=some arg ARG2=some other \"arg\"\n```\n\nWith the helper\n\n```console\nARG1=\"some arg\" ARG2=\"some other \\\"arg\\\"\" render-template \u003c\u003c\"EOF\"\nARG1={{quote ARG1}} ARG2={{quote ARG2}}\nEOF\nARG1=\"some arg\" ARG2=\"some other \\\"arg\\\"\"\n```\n\n### or\n\nThis helper allows using the \"or\" logical operation over two values (a value will be true if not empty)\n\nTo render a block when either \"firstName\" or \"lastName\" values are not empty:\n\n```console\n$ cat \u003e data.tpl \u003c\u003c\"EOF\" \n{{#if (or firstName lastName)}}\n{{firstName}} {{lastName}}\n{{else}}\nUnknown Author\n{{/if}}\nEOF\n\n$ render-template data.tpl\nUnknown Author\n\n$ firstName=foo render-template data.tpl\nfoo\n\n$ lastName=bar render-template data.tpl\nbar\n \n$ firstName=foo lastName=bar render-template data.tpl\nfoo bar\n```\n\nThis helper can also be used to provide defaults for your template variables:\n\n```console\n# No value provided, so we fallback to the second \"or\" argument\n$ render-template \u003c\u003c\u003c'VALUE={{or ENV_VALUE \"default value\"}}'\nVALUE=default value\n\n# ENV_VALUE is defined, so we take it\n$ ENV_VALUE=\"customized value\" render-template \u003c\u003c\u003c'VALUE={{or ENV_VALUE \"default value\"}}'\nVALUE=customized value\n```\n\n## License\n\nCopyright \u0026copy; 2025 Broadcom. The term \"Broadcom\" refers to Broadcom Inc. and/or its subsidiaries.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License.\n\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitnami%2Frender-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitnami%2Frender-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitnami%2Frender-template/lists"}