@znemz/cfn-include
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -98,3 +98,3 @@ #!/usr/bin/env node | ||
template = opts.doEnv ? replaceEnv(template) : template; | ||
template = opts.enable === 'env' ? replaceEnv(template) : template; | ||
@@ -101,0 +101,0 @@ return include({ |
13
index.js
@@ -14,3 +14,3 @@ var _ = require('lodash'), | ||
yaml = require('./lib/yaml'), | ||
jmespath = require('jmespath'), | ||
{ getParser } = require('./lib/include/query'), | ||
deepMerge = require('deepmerge'), | ||
@@ -234,2 +234,3 @@ parseLocation = require('./lib/parselocation'), | ||
async function include(base, scope, args, doEnv) { | ||
const procTemplate = args.doEnv? replaceEnv : passThrough; | ||
args = _.defaults(_.isPlainObject(args) ? { ...args, doEnv } : { | ||
@@ -243,3 +244,3 @@ location: args, | ||
absolute = location.relative ? path.join(path.dirname(base.path), location.host, location.path || '') : [location.host, location.path].join(''); | ||
body = readFile(absolute); | ||
body = readFile(absolute).then(procTemplate); | ||
absolute = location.protocol + '://' + absolute; | ||
@@ -255,7 +256,7 @@ } else if (location.protocol === 's3') { | ||
Key: key, | ||
}).promise().then(res => res['Body'].toString()); | ||
}).promise().then(res => res['Body'].toString()).then(procTemplate); | ||
} else if (location.protocol && location.protocol.match(/^https?$/)) { | ||
var basepath = pathParse(base.path).dir + '/'; | ||
absolute = location.relative ? url.resolve(location.protocol + '://' + base.host + basepath, location.raw) : location.raw; | ||
body = request(absolute); | ||
body = request(absolute).then(procTemplate); | ||
} | ||
@@ -265,3 +266,3 @@ return handleIncludeBody({scope, args, body, absolute }); | ||
function passThrough(template) { return template; } | ||
function passThrough(template) { return template; } | ||
@@ -277,3 +278,3 @@ async function handleIncludeBody({ scope, args, body, absolute }) { | ||
const query = _.isString(args.query) ? args.query : await recurse(parseLocation(absolute), scope, args.query, args.doEnv); | ||
template = jmespath.search(template, query); | ||
template = getParser(args.parser)(template, query); | ||
} | ||
@@ -280,0 +281,0 @@ return recurse(parseLocation(absolute), scope, template, args.doEnv); |
var _ = require('lodash'), | ||
AWS = require('aws-sdk-proxy'), | ||
jmespath = require('jmespath'); | ||
jmespath = require('jmespath') | ||
{ getParser } = require('./query'); | ||
@@ -8,4 +9,4 @@ module.exports = function(args) { | ||
return service[args.action](args.parameters ? args.parameters : {}).promise().then(function(res) { | ||
return args.query ? jmespath.search(res, args.query) : res; | ||
return args.query ? getParser(args.parser)(res, args.query) : res; | ||
}); | ||
} |
{ | ||
"name": "@znemz/cfn-include", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "Preprocessor for CloudFormation templates with support for loops and flexible include statements", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43888
15
683