@znemz/cfn-include 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -32,9 +32,10 @@ const { isOurExplicitFunction } = require('./lib/schema');
32
32
  * optional and can be derived from url
33
33
  * @param {string} [options.url] '(file|s3):///SOME_FILE_PATH.(json|yaml)'
34
34
  * @param {boolean} options.doEnv inject environment from process.env as well
35
+ * @param {boolean} options.doEval allow Fn::Eval to be used (js eval)
35
36
  * @param {Object.<string, string>} [options.inject] object to
36
37
  * inject { KEY: Value } from where ${KEY}
37
- * is subtituted with Value
38
+ * is substituted with Value
38
39
  * @param {boolean} [options.doLog] log all arguments at the include recurse level
39
40
  *
40
41
  * Example: Load off off file system
@@ -49,6 +50,9 @@ const { isOurExplicitFunction } = require('./lib/schema');
49
50
  */
50
51
  module.exports = async function (options) {
51
52
  let { template } = options;
53
+ options.doEnv = getBoolEnvOpt(options.doEnv, 'CFN_INCLUDE_DO_ENV');
54
+ options.doEval = getBoolEnvOpt(options.doEval, 'CFN_INCLUDE_DO_EVAL');
55
+
52
56
  const base = parseLocation(options.url);
53
57
  const scope = options.scope || {};
54
58
  if (base.relative) throw new Error('url cannot be relative');
@@ -718,3 +722,7 @@ function JSONifyString(string) {
718
722
  });
719
723
  return lines;
720
724
  }
725
+
726
+ function getBoolEnvOpt(opt, envKey) {
727
+ return process.env[envKey] ? !!process.env[envKey] : opt;
728
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@znemz/cfn-include",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "Preprocessor for CloudFormation templates with support for loops and flexible include statements",
5
5
  "keywords": [
6
6
  "aws",