Coder Social home page Coder Social logo

cgmartin / envhandlebars Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 2.0 300 KB

Substitutes environment variables in Handlebars templates, useful for configuration files in Docker

JavaScript 85.96% Dockerfile 12.29% Shell 1.75%
docker config-template mustache-templates handlebars

envhandlebars's People

Contributors

cgmartin avatar dependabot[bot] avatar luisdavim avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

envhandlebars's Issues

Error when running in container clusters

When an application uses this library to handle environment variables and is ran in a container cluster (like Marathon or Kubernetes), where envvars set by such software could be PORT=<container_port> and PORT_<lb_port>=<container_port>, for the example variables of PORT=2345 and PORT_1234=2345 a following backtrace is thrown and the application errors out.

/usr/local/lib/node_modules/envhandlebars/index.js:74
                vars[match[1]][match[2]] = opts.env[key];
                                         ^
TypeError: Cannot create property '1234' on string '2345'
    at parseVar (/usr/local/lib/node_modules/envhandlebars/index.js:74:42)
    at /usr/local/lib/node_modules/envhandlebars/index.js:52:13
    at Array.forEach (<anonymous>)
    at getVars (/usr/local/lib/node_modules/envhandlebars/index.js:51:31)
    at applyTemplate (/usr/local/lib/node_modules/envhandlebars/index.js:40:35)
    at ConcatStream.<anonymous> (/usr/local/lib/node_modules/envhandlebars/node_modules/concat-stream/index.js:36:43)
    at ConcatStream.emit (events.js:164:20)
    at finishMaybe (/usr/local/lib/node_modules/envhandlebars/node_modules/readable-stream/lib/_stream_writable.js:607:14)
    at endWritable (/usr/local/lib/node_modules/envhandlebars/node_modules/readable-stream/lib/_stream_writable.js:615:3)
    at ConcatStream.Writable.end (/usr/local/lib/node_modules/envhandlebars/node_modules/readable-stream/lib/_stream_writable.js:571:41)
Converting: /opt/admin/env/cfg.json.tpl
/usr/local/lib/node_modules/envhandlebars/index.js:74
                vars[match[1]][match[2]] = opts.env[key];
                                         ^
TypeError: Cannot create property '1234' on string '2345'
    at parseVar (/usr/local/lib/node_modules/envhandlebars/index.js:74:42)
    at /usr/local/lib/node_modules/envhandlebars/index.js:52:13
    at Array.forEach (<anonymous>)
    at getVars (/usr/local/lib/node_modules/envhandlebars/index.js:51:31)
    at applyTemplate (/usr/local/lib/node_modules/envhandlebars/index.js:40:35)
    at ConcatStream.<anonymous> (/usr/local/lib/node_modules/envhandlebars/node_modules/concat-stream/index.js:36:43)
    at ConcatStream.emit (events.js:164:20)
    at finishMaybe (/usr/local/lib/node_modules/envhandlebars/node_modules/readable-stream/lib/_stream_writable.js:607:14)
    at endWritable (/usr/local/lib/node_modules/envhandlebars/node_modules/readable-stream/lib/_stream_writable.js:615:3)
    at ConcatStream.Writable.end (/usr/local/lib/node_modules/envhandlebars/node_modules/readable-stream/lib/_stream_writable.js:571:41)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.