Support config-based values for version #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @mikesouza, this plugin is great! I recently ran into a slight issue though and would like to attempt to address it with this PR if you are open to contributions.
Currently, if you try to pass in the version from a configuration file, the plugin will output the following regardless if
V2
orRegional
is passed in.This is because currently the validation is being handled in the constructor before the plugin is bound to the serverless configuration, so when
${this.config.version}
is getting checked, it results in the string literal that's passed in from the serverless template - in my case:${{self:custom.WafVersion}}
.Moving the verify steps and initializing
this.wafVersion
within a bound function will interpolate the provided value properly. To do this and maintain the current behavior, I've moved theverifyValidWafConfig
function to be called as part of thebefore:package:cleanup
lifecycle hook.When installing packages, I saw there were a few vulnerabilities reported, so I ran
npm audit fix
to resolve what was found. The current version of serverless this package depends on is a couple majors behind, so I was wary of upgrading it from even 1.x to 2.x, in the event that it may introduce breaking changes to any consumers.