Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add setup docs #1

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EVENTS_API_CLIENT_SECRET=XXX
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,35 @@

## Run Locally
1. `yarn -D`
2. `make local`
2. `make check_account_dev` - If this fails make sure that AWS is configured.
3. `make local`

## Build for AWS Lambda
1. `make clean`
2. `make build`

## Deploy to AWS env

1. Get AWS credentials with `aws configure sso`
2. Ensure AWS profile is set to the right account (DEV or PROD).
3. Run `make deploy_dev` or `make deploy_prod`.
3. Run `make deploy_dev` or `make deploy_prod`.

## Generating JWT token

Create a `.env` file containing your `CLIENT_SECRET`.

```bash
node --env-file=.env get_msft_jwt.js
```

## Configuring AWS

```
aws configure sso
```

Log in with SSO. Then, export the `AWS_PROFILE` that the above command outputted.

```bash
export AWS_PROFILE=ABC-DEV
```
2 changes: 2 additions & 0 deletions src/routes/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ const eventsPlugin: FastifyPluginAsync = async (fastify, _options) => {
} catch (e: unknown) {
if (e instanceof Error) {
request.log.error("Failed to get from DynamoDB: " + e.toString());
} else {
request.log.error(`Failed to get from DynamoDB. ${e}`);
}
throw new DatabaseFetchError({
message: "Failed to get events from Dynamo table.",
Expand Down
Loading