Skip to content

Commit

Permalink
Merge pull request #208 from ap2020/feature/setup-dev-stage
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzacat83 authored Mar 14, 2021
2 parents 652a7a8 + 4d4c93a commit c04886f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion aws/src/lib/envvar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion aws/src/lib/envvar/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class EnvVarProd implements EnvVar {

private async fetch(key: EnvVarKey): Promise<string> {
const res = await this.ssm.getParameter({
Name: `/ap2020bot/${key}`,
Name: `/ap2020bot/${process.env.STAGE}/${key}`,
WithDecryption: true,
}).promise();
const value = res.Parameter.Value;
Expand Down
2 changes: 1 addition & 1 deletion aws/src/lib/slack/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <Event extends SlackEvent>(callback: ((message: SlackSNSMessage<Event>) => Promise<void>)): SNSHandler => {
Expand Down

0 comments on commit c04886f

Please sign in to comment.