Skip to content

Commit 100f814

Browse files
committed
Update config template, add checks for missing config
1 parent 5ef9aad commit 100f814

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

slsdevtools.config.js.dist

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
module.exports = {
2-
deploymentArgs: '--capabilities CAPABILITY_IAM --s3-bucket deployment-bucket-name',
3-
};
2+
deploymentArgs:
3+
"--capabilities CAPABILITY_IAM --s3-bucket deployment-bucket-name",
4+
guardian: {
5+
ignore: {
6+
"no-default-memory": true, // global
7+
"no-default-memory": ["arn1", "arn2", "arn3"], // ignore particular resources
8+
"no-default-memory": "6 May 2020 09:00 GMT", // ignore until a particular date
9+
},
10+
},
11+
};

src/guardian/index.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ class GuardianCI {
6161
this.allFunctions = [];
6262
this.stackFunctions = [];
6363

64-
this.config = program.slsDevToolsConfig.guardian;
64+
if (program.slsDevToolsConfig) {
65+
this.config = program.slsDevToolsConfig.guardian;
66+
}
6567
if (this.config) {
6668
this.ignoreConfig = this.config.ignore;
6769
}
@@ -117,9 +119,13 @@ class GuardianCI {
117119
}
118120

119121
ignoreArns(check, stackFunctions) {
120-
const arns = this.ignoreConfig[check.name];
121-
if (arns instanceof Array) {
122-
return stackFunctions.filter((func) => !arns.includes(func.FunctionArn));
122+
if (this.ignoreConfig) {
123+
const arns = this.ignoreConfig[check.name];
124+
if (arns instanceof Array) {
125+
return stackFunctions.filter(
126+
(func) => !arns.includes(func.FunctionArn)
127+
);
128+
}
123129
}
124130
return stackFunctions;
125131
}

0 commit comments

Comments
 (0)