{"id":24430558,"url":"https://github.com/cgmartin/envhandlebars","last_synced_at":"2025-10-08T03:46:30.084Z","repository":{"id":5797096,"uuid":"53948763","full_name":"cgmartin/envhandlebars","owner":"cgmartin","description":"Substitutes environment variables in Handlebars templates, useful for configuration files in Docker","archived":false,"fork":false,"pushed_at":"2022-12-30T18:24:11.000Z","size":300,"stargazers_count":16,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-02T09:41:39.844Z","etag":null,"topics":["config-template","docker","handlebars","mustache-templates"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cgmartin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-15T13:56:15.000Z","updated_at":"2022-11-30T14:41:22.000Z","dependencies_parsed_at":"2023-01-13T13:42:17.973Z","dependency_job_id":null,"html_url":"https://github.com/cgmartin/envhandlebars","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/cgmartin/envhandlebars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgmartin%2Fenvhandlebars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgmartin%2Fenvhandlebars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgmartin%2Fenvhandlebars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgmartin%2Fenvhandlebars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cgmartin","download_url":"https://codeload.github.com/cgmartin/envhandlebars/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgmartin%2Fenvhandlebars/sbom","scorecard":{"id":272500,"data":{"date":"2025-08-11","repo":{"name":"github.com/cgmartin/envhandlebars","commit":"149687451cfb6c222f2e6e3b95a52709edbc3aee"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.4,"checks":[{"name":"Code-Review","score":2,"reason":"Found 7/27 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Info: Possibly incomplete results: error parsing shell code: not a valid arithmetic operator: socat: .devcontainer/docker-init.sh:0","Warn: containerImage not pinned by hash: .devcontainer/dev.Dockerfile:1: pin your Docker image by updating buildpack-deps:buster-curl to buildpack-deps:buster-curl@sha256:7d05c913226d1bd2e8d019d03ed34310c3742f30b818f54fda97ee8d2a9fbb8d","Warn: downloadThenRun not pinned by hash: .devcontainer/dev.Dockerfile:39-42","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"15 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T13:44:00.486Z","repository_id":5797096,"created_at":"2025-08-17T13:44:00.486Z","updated_at":"2025-08-17T13:44:00.486Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278886408,"owners_count":26062975,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["config-template","docker","handlebars","mustache-templates"],"created_at":"2025-01-20T14:31:17.986Z","updated_at":"2025-10-08T03:46:30.069Z","avatar_url":"https://github.com/cgmartin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"envhandlebars\n=============\n\n[![Dependency Status](https://david-dm.org/cgmartin/envhandlebars.svg)](https://david-dm.org/cgmartin/envhandlebars)\n[![npm version](https://badge.fury.io/js/envhandlebars.svg)](http://badge.fury.io/js/envhandlebars)\n[![Build Status](https://travis-ci.org/cgmartin/envhandlebars.svg?branch=master)](https://travis-ci.org/cgmartin/envhandlebars)\n\nA simple templating utility, akin to [`envsubst`](http://linuxcommand.org/man_pages/envsubst1.html), but using [Handlebars](http://handlebarsjs.com/) for more complex logic.\n\nEnvironment variables are used as the data input to a Handlebars template:\n```\n$ export NAME=world\n$ echo \"Hello {{NAME}}\" | envhandlebars\nHello world\n```\n\nThis is particularly useful for dynamic configuration files in Docker containers and other [12-Factor applications](http://12factor.net/).\n\n## Install\n\n```\n$ npm install -g envhandlebars\n```\n\n## Usage\n\nRedirect a Mustache template file into stdin of `envhandlebars` and redirect the rendered stdout to a file:\n```\nUsage:\n    envhandlebars [options] \u003c templatefile \u003e renderedfile\n\nOptions:\n    --array-var-prefix=\"PRE_\"  process arrays only for vars with the specified prefix [Default: all]\n    --no-arrays                disable variable name array processing\n    -h, --help                 print usage information\n```\n\n## Complex Examples\n\n### Conditionals\n\nMustache conditionals can be used as is...\n\nTemplate:\n```\n{{#if WORLD}}Hello {{WORLD}}{{/if}}!\n```\n\nEnv vars:\n```bash\nWORLD=world\n```\n\nOutput:\n```\nHello world!\n```\n\nSee the [if block helper](http://handlebarsjs.com/builtin_helpers.html#conditionals) docs page for more information.\n\n\n### Iterators\n\nMustache iterators require using a special environment variable naming convention...\n\n**Array of strings**\n\nTemplate:\n```\n{{#each PEOPLE}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}!\n```\n\nEnv vars:\n```bash\n# Convention: {VARNAME}_{INDEX}\nPEOPLE_0=Chris\nPEOPLE_1=John\nPEOPLE_2=Shayne\n```\n\nOutput:\n```\nChris, John, Shayne!\n```\n\n**Array of objects**\n\nTemplate:\n```\n{{#each PEOPLE}}{{FIRST}} {{LAST}}{{#unless @last}}, {{/unless}}{{/each}}!\n```\n\nEnv vars:\n```bash\n# Convention: {VARNAME}_{INDEX}_{PROPERTY}\nPEOPLE_0_FIRST=Chris\nPEOPLE_0_LAST=Martin\nPEOPLE_1_FIRST=John\nPEOPLE_1_LAST=Papa\nPEOPLE_2_FIRST=Shayne\nPEOPLE_2_LAST=Boyer\n```\n\nOutput:\n```\nChris Martin, John Papa, Shayne Boyer!\n```\n\nSee the [each block helper](http://handlebarsjs.com/builtin_helpers.html#iteration) docs page for more information.\n\n**NOTE:**\n\nSome environments may have variables that conflict with this convention.\n\nUse the `--array-var-prefix=FOO_` option to enable iterators only for variables that start with `FOO_`.\n\nAlternatively, iterator parsing can be completely disabled with the `--no-arrays` option.\n\n\n## Docker Usage\n\nTo generate configuration dynamically within a docker container, `envhandlebars` can be used before the main process starts. It can be done in the `CMD` or within a wrapper script.\n\nHere is an example docker-compose.yml for a custom nginx container:\n```\nnginx:\n  build: .\n  volumes:\n   - ./mysite.template:/etc/nginx/conf.d/mysite.template\n  ports:\n   - \"8080:80\"\n  environment:\n   - NGINX_HOST=foobar.com\n   - NGINX_PORT=80\n  command: /bin/bash -c \"envhandlebars \u003c /etc/nginx/conf.d/mysite.template \u003e /etc/nginx/conf.d/default.conf \u0026\u0026 nginx -g 'daemon off;'\"\n```\n\nThe mysite.template file may then contain variable references like this:\n```\nlisten {{NGINX_PORT}};\n```\n\nYou just need to make sure to install Node.js and envhandlebars (via npm) within your custom Dockerfile.\n\nFor debian-based images:\n```\nRUN apt-get update \u0026\u0026 apt-get install -y nodejs \u0026\u0026 npm i -g envhandlebars\n```\n\nFor alpine-based images:\n```\nRUN apk add --update nodejs \u0026\u0026 npm i -g envhandlebars\n```\n\n## Custom Helpers or Partials\n\n**(New in v1.3.0+)**\n\nCustom Mustache helpers and partials can be implemented by extending the `envhandlebars` module with your own Node.js wrapper script:\n\n```javascript\n#!/usr/bin/env node\n// Script: `myenvhandlebars`\n'use strict';\nvar envhandlebars = require('envhandlebars');\n\n// The Handlebars context is passed into this function\n// for registering helpers, partials or other extensions.\nfunction extendHandlebars(Handlebars) {\n    Handlebars.registerHelper('fullName', function(first, last) {\n        return last + ', ' + first;\n    });\n}\n\nenvhandlebars({\n    extendHandlebars: extendHandlebars\n});\n```\n\nSee the [custom helpers](http://handlebarsjs.com/#helpers) docs page for more information.\n\n## License\n\n[MIT License](http://cgm.mit-license.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgmartin%2Fenvhandlebars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcgmartin%2Fenvhandlebars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgmartin%2Fenvhandlebars/lists"}