Skip to content

Commit

Permalink
fix(Variables): Fix support for ${self:}
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 5, 2020
1 parent fd451ca commit ac34110
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/classes/Service.js
Expand Up @@ -20,7 +20,7 @@ class Service {
this.serviceObject = null;
this.provider = {
stage: 'dev',
variableSyntax: '\\${([^{}:]+?(?:\\(|:)[^:{}][^{}]*?)}',
variableSyntax: '\\${([^{}:]+?(?:\\(|:)(?:[^:{}][^{}]*?)?)}',
};
this.custom = {};
this.plugins = [];
Expand Down
3 changes: 3 additions & 0 deletions lib/classes/Variables.test.js
Expand Up @@ -2769,5 +2769,8 @@ module.exports = {
it('should support ${self:key} syntax', () => {
expect(processedConfig.custom.selfReference).to.equal('bar');
});
it('should support ${self:} syntax', () => {
expect(processedConfig.custom.serviceReference).to.equal(processedConfig);
});
});
});
1 change: 1 addition & 0 deletions test/fixtures/variables/serverless.yml
Expand Up @@ -10,3 +10,4 @@ custom:
awsVariable: ${AWS::Region}
cloudFormationReference: ${AnotherResource}
selfReference: ${self:custom.importedFileWithKey}
serviceReference: ${self:}

0 comments on commit ac34110

Please sign in to comment.