From aa143e63c223ea61cd7aa46f0d0d61bea103ae3b Mon Sep 17 00:00:00 2001 From: key kim Date: Sat, 3 Oct 2020 13:08:27 +0900 Subject: [PATCH] parameterize region as query --- src/routes/v1/Aws.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/routes/v1/Aws.ts b/src/routes/v1/Aws.ts index 40520a9..89db423 100644 --- a/src/routes/v1/Aws.ts +++ b/src/routes/v1/Aws.ts @@ -7,10 +7,11 @@ const router = Router(); router.get('/securitygroups', async (req: Request, res: Response) => { - const { region, access_key, secret_key } = req.headers; - + const { access_key, secret_key } = req.headers; + const { region } = req.query + let ret:PromiseType = await execShellCommand(`docker-compose -f helper/docker-compose.yml run \ - -e AWS_DEFAULT_REGION=${region} \ + -e AWS_DEFAULT_REGION=${region || 'us-east-1'} \ -e AWS_ACCESS_KEY_ID=${access_key} \ -e AWS_SECRET_ACCESS_KEY=${secret_key} \ --rm aws ec2 describe-security-groups \