Skip to content

Commit 8ec7330

Browse files
fix: CLI --cdkstack parameter
1 parent f485242 commit 8ec7330

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cli/cli.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ async function run() {
114114

115115
if (request.url === '/stackList') {
116116
response.writeHead(200, { 'Content-Type': 'application/json' });
117-
response.end(JSON.stringify(stackList), 'utf-8');
117+
118+
const stackListAvailable: string[] | undefined =
119+
options.cdkstack && stackList?.includes(options.cdkstack)
120+
? [options.cdkstack]
121+
: stackList;
122+
123+
response.end(JSON.stringify(stackListAvailable), 'utf-8');
118124
} else if (request.url?.match('^/wsUrl')) {
119125
let wsUrl: string | undefined;
120126
if (options.ws) {
@@ -124,10 +130,6 @@ async function run() {
124130
const urlPaths = request.url.split('/');
125131
let stack = urlPaths[2];
126132

127-
if (!stack) {
128-
stack = options.cdkstack;
129-
}
130-
131133
if (stack) {
132134
wsUrl = cdkOutput[stack].ServerlessSpyWsUrl;
133135
} else {

0 commit comments

Comments
 (0)