Skip to content

Commit

Permalink
feat: update serverless config
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelvesavuori committed Sep 9, 2024
1 parent 88bcd10 commit 9bfb538
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ service: gitmetrix

provider:
name: aws
runtime: nodejs18.x
stage: ${opt:stage, 'dev'}
runtime: nodejs20.x
architecture: arm64
stage: ${opt:stage, 'prod'}
region: ${opt:region, 'eu-north-1'}
memorySize: ${opt:memory, 512}
memorySize: ${opt:memory, 1024}
timeout: ${opt:timeout, 10}
logRetentionInDays: ${opt:logRetentionInDays, 7}
versionFunctions: false
Expand Down Expand Up @@ -141,4 +142,4 @@ resources:
StreamViewType: NEW_AND_OLD_IMAGES
BillingMode: PAY_PER_REQUEST
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
PointInTimeRecoveryEnabled: true
6 changes: 3 additions & 3 deletions src/usecases/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import { InvalidAuthTokenError } from '../application/errors/errors';

const AUTHORIZATION_TOKEN =
process.env.NODE_ENV === 'test'
? '65a662ab-9d57-4f72-aff1-3a63e0738ace'
? '6d0bf792-ad5a-49af-9ff5-78fbc15a3e8a'
: process.env.API_KEY || '';

/**
* @description Authorizer that will check for the `authorization` query string
* parameter or `Authorization` header for an authorization token and see if it's
* the correct and expected one.
*
* @example `?authorization=65a662ab-9d57-4f72-aff1-3a63e0738ace` query string parameter.
* @example `Authorization: 65a662ab-9d57-4f72-aff1-3a63e0738ace` header.
* @example `?authorization=6d0bf792-ad5a-49af-9ff5-78fbc15a3e8a` query string parameter.
* @example `Authorization: 6d0bf792-ad5a-49af-9ff5-78fbc15a3e8a` header.
*/
export async function authorize(event: EventInput) {
try {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/usecases/authorize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test('It should allow a call with the correct authorization query string paramet
headers: {
'User-Agent': ''
},
identitySource: ['65a662ab-9d57-4f72-aff1-3a63e0738ace']
identitySource: ['6d0bf792-ad5a-49af-9ff5-78fbc15a3e8a']
});
const result = response['isAuthorized'];
expect(result).toBe(expected);
Expand All @@ -23,7 +23,7 @@ test('It should allow a call with the correct authorization header', async () =>
body: {},
headers: {
'User-Agent': '',
Authorization: '65a662ab-9d57-4f72-aff1-3a63e0738ace'
Authorization: '6d0bf792-ad5a-49af-9ff5-78fbc15a3e8a'
},
identitySource: []
});
Expand Down

0 comments on commit 9bfb538

Please sign in to comment.