serverless-pseudo-parameters
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -111,2 +111,9 @@ 'use strict'; | ||
var escaped_regex = /#@{([^}]+)}/g; | ||
if (typeof value === 'string' && value.search(escaped_regex) >= 0) { | ||
let replacedString = value.replace(escaped_regex, '#{$1}'); | ||
dictionary[key] = replacedString; | ||
} | ||
// dicts and arrays need to be looped through | ||
@@ -113,0 +120,0 @@ if (isDict(value) || isArray(value)) { |
@@ -36,2 +36,5 @@ const Plugin = require('.'); | ||
"Fn::Sub": "#{SomeResource}" | ||
}, | ||
Escaping: { | ||
StringValue: "#@{myOutputS3Loc}/#@{format(@scheduledStartTime, 'YYYY-MM-dd-HH-mm-ss')}" | ||
} | ||
@@ -45,7 +48,7 @@ } | ||
resultTemplate = serverlessPseudoParamsPlugin.serverless.service.provider.compiledCloudFormationTemplate; | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(10); | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(11); | ||
}); | ||
it('replaces #{AWS::[VAR]} with the correct CF pseudo parameter', () => { | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(10); | ||
expect(Object.keys(resultTemplate.Resources.acmeResource.Properties).length).toEqual(11); | ||
}); | ||
@@ -83,3 +86,5 @@ | ||
}); | ||
it('should not replace escaped items', () => { | ||
expect(resultTemplate.Resources.acmeResource.Properties.Escaping).toEqual({ 'StringValue': '#{myOutputS3Loc}/#{format(@scheduledStartTime, \'YYYY-MM-dd-HH-mm-ss\')}'}); | ||
}); | ||
}); | ||
@@ -86,0 +91,0 @@ |
{ | ||
"name": "serverless-pseudo-parameters", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"devDependencies": { | ||
"jest": "^22.4.4" | ||
"jest": "^24.9.0" | ||
}, | ||
@@ -7,0 +7,0 @@ "license": "MIT", |
@@ -100,1 +100,13 @@ Serverless AWS Pseudo Parameters | ||
``` | ||
Escaping tokens | ||
----------------------------------- | ||
You can prevent tokens from being replaced by escaping with the `@` character after the token's hash character | ||
```yaml | ||
DynamoDBInputS3OutputHive: | ||
Type: AWS::DataPipeline::Pipeline | ||
Properties: | ||
PipelineObjects: | ||
- Key: "directoryPath" | ||
StringValue: "#@{myOutputS3Loc}/#@{format(@scheduledStartTime, 'YYYY-MM-dd-HH-mm-ss')}" | ||
``` |
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
18399
6
306
112