cgmartin / envhandlebars Goto Github PK
View Code? Open in Web Editor NEWSubstitutes environment variables in Handlebars templates, useful for configuration files in Docker
Substitutes environment variables in Handlebars templates, useful for configuration files in Docker
Investigate if variable expansion could be utilized with envhandlebars
: https://github.com/motdotla/dotenv-expand
When converting, if the variables, for example, account_key
, are not set, the part of codes {{ account_key }}
, will be blank.
Can we not change to blank if some variables are not set
Hi, do you think it would be possible to include those extra helpers so that we could use more complex templates?
Request for comments on supporting Handlebars each block expressions via Environment variables. What conventions/options would users like to see?
http://handlebarsjs.com/builtin_helpers.html#iteration
http://handlebarsjs.com/#paths
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.