Skip to content

Commit

Permalink
Update config template, add checks for missing config
Browse files Browse the repository at this point in the history
  • Loading branch information
mansurpasha committed May 7, 2020
1 parent 5ef9aad commit 100f814
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 10 additions & 2 deletions slsdevtools.config.js.dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
module.exports = {
deploymentArgs: '--capabilities CAPABILITY_IAM --s3-bucket deployment-bucket-name',
};
deploymentArgs:
"--capabilities CAPABILITY_IAM --s3-bucket deployment-bucket-name",
guardian: {
ignore: {
"no-default-memory": true, // global
"no-default-memory": ["arn1", "arn2", "arn3"], // ignore particular resources
"no-default-memory": "6 May 2020 09:00 GMT", // ignore until a particular date
},
},
};
14 changes: 10 additions & 4 deletions src/guardian/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ class GuardianCI {
this.allFunctions = [];
this.stackFunctions = [];

this.config = program.slsDevToolsConfig.guardian;
if (program.slsDevToolsConfig) {
this.config = program.slsDevToolsConfig.guardian;
}
if (this.config) {
this.ignoreConfig = this.config.ignore;
}
Expand Down Expand Up @@ -117,9 +119,13 @@ class GuardianCI {
}

ignoreArns(check, stackFunctions) {
const arns = this.ignoreConfig[check.name];
if (arns instanceof Array) {
return stackFunctions.filter((func) => !arns.includes(func.FunctionArn));
if (this.ignoreConfig) {
const arns = this.ignoreConfig[check.name];
if (arns instanceof Array) {
return stackFunctions.filter(
(func) => !arns.includes(func.FunctionArn)
);
}
}
return stackFunctions;
}
Expand Down

0 comments on commit 100f814

Please sign in to comment.