From d96661bf6dea39534acef3a9b14cf6725f963d90 Mon Sep 17 00:00:00 2001 From: pizzacat83 <17941141+pizzacat83@users.noreply.github.com> Date: Sun, 14 Mar 2021 18:22:18 +0900 Subject: [PATCH 1/3] :sparkles: use stage specific envvar --- aws/src/lib/envvar/prod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/src/lib/envvar/prod.ts b/aws/src/lib/envvar/prod.ts index 1b216957..da5576d0 100644 --- a/aws/src/lib/envvar/prod.ts +++ b/aws/src/lib/envvar/prod.ts @@ -8,7 +8,7 @@ class EnvVarProd implements EnvVar { private async fetch(key: EnvVarKey): Promise { const res = await this.ssm.getParameter({ - Name: `/ap2020bot/${key}`, + Name: `/ap2020bot/${process.env.STAGE}/${key}`, WithDecryption: true, }).promise(); const value = res.Parameter.Value; From e910240984ec4fd5f4da94289dd4a912286cab85 Mon Sep 17 00:00:00 2001 From: pizzacat83 <17941141+pizzacat83@users.noreply.github.com> Date: Sun, 14 Mar 2021 23:22:06 +0900 Subject: [PATCH 2/3] :sparkles: aws/slack/events: use stage specific SNS topic --- aws/src/lib/slack/events/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/src/lib/slack/events/index.ts b/aws/src/lib/slack/events/index.ts index 376c1388..60d238ff 100644 --- a/aws/src/lib/slack/events/index.ts +++ b/aws/src/lib/slack/events/index.ts @@ -3,7 +3,7 @@ import { SNSHandler } from "aws-lambda" import { SlackEvent, SlackSNSMessage } from "./types" export const getSlackEventTopicARN = async () => { - return `arn:aws:sns:us-east-1:${await envvar.get('aws/account-id')}:ap2020bot-prod-slack-events` // TODO: use env.STAGE + return `arn:aws:sns:us-east-1:${await envvar.get('aws/account-id')}:ap2020bot-${process.env.STAGE}-slack-events` } export const createHandler = (callback: ((message: SlackSNSMessage) => Promise)): SNSHandler => { From 4d4c93acba433fad49f08a292998d157b8195f83 Mon Sep 17 00:00:00 2001 From: pizzacat83 <17941141+pizzacat83@users.noreply.github.com> Date: Sun, 14 Mar 2021 23:22:40 +0900 Subject: [PATCH 3/3] :sparkles: support dev envvar --- aws/src/lib/envvar/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aws/src/lib/envvar/index.ts b/aws/src/lib/envvar/index.ts index 2446ec34..369e9717 100644 --- a/aws/src/lib/envvar/index.ts +++ b/aws/src/lib/envvar/index.ts @@ -12,7 +12,8 @@ import { envvarLocal } from './local'; export const envvar: EnvVar = (() => { switch (process.env.STAGE) { - case 'prod': { + case 'prod': + case 'dev': { return envvarProd; } /// #if STAGE === 'local'