-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified constructors and xray configuration
- Loading branch information
Showing
6 changed files
with
36 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { LambdaClient } from '@aws-sdk/client-lambda'; | ||
import { S3Client } from '@aws-sdk/client-s3'; | ||
import * as AWSXRay from 'aws-xray-sdk'; | ||
import { Container, Service } from 'typedi'; | ||
import { IInvokeConfig } from '../models'; | ||
import { Configuration } from '../utils/Configuration'; | ||
|
||
@Service() | ||
export class DependencyInjection { | ||
public static register() { | ||
const config: IInvokeConfig = Configuration.getInstance().getInvokeConfig(); | ||
|
||
Container.set(LambdaClient, AWSXRay.captureAWSv3Client(new LambdaClient(config.params))); | ||
Container.set(S3Client, AWSXRay.captureAWSv3Client(new S3Client(config))); | ||
|
||
const isOffline = (process.env.IS_OFFLINE ?? false) as boolean; | ||
if (isOffline) { | ||
// Needed for later. | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
import { DependencyInjection } from './config/DependencyInjection'; | ||
import { certGen } from './functions/certGen'; | ||
|
||
const isOffline: boolean = !process.env.BRANCH || process.env.BRANCH === 'local'; | ||
DependencyInjection.register(); | ||
|
||
let credentials = {}; | ||
|
||
if (isOffline) { | ||
credentials = { | ||
accessKeyId: 'accessKey1', | ||
secretAccessKey: 'verySecretKey1', | ||
}; | ||
} | ||
|
||
export { credentials }; | ||
export { certGen as handler }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters