Skip to content

Commit

Permalink
chore(sqs): Export local sqs (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
pandomic authored Oct 24, 2020
1 parent 8f8eb18 commit 8fc54e3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@advanon-ag/aws-access-utils",
"version": "2.2.7",
"version": "2.2.8",
"description": "Library for accessing AWS services",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
20 changes: 20 additions & 0 deletions src/aws/sqs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import AWS from './aws';

import {
isOffline,
getLocalRegion,
getLocalEndpointSqs,
getRegion
} from '../config';

const options = {
region: getRegion(),
apiVersion: '2012-11-05'
};

const optionsLocal = {
region: getLocalRegion(),
endpoint: getLocalEndpointSqs(),
};

export const sns = new AWS.SQS(isOffline() ? optionsLocal : options);
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const getLocalEndpointStepFunctions = (): string =>

export const getLocalEndpointSns = (): string => process.env.LOCAL_SNS_ENDPOINT || DEFAULT_LOCAL_ENDPOINT;

export const getLocalEndpointSqs = (): string => process.env.LOCAL_SQS_ENDPOINT || DEFAULT_LOCAL_ENDPOINT;

export const getLocalEndpointSes = (): string => process.env.LOCAL_SES_ENDPOINT || DEFAULT_LOCAL_ENDPOINT;

export const getLocalEndpointSsm = (): string => process.env.LOCAL_SSM_ENDPOINT || DEFAULT_LOCAL_ENDPOINT;

0 comments on commit 8fc54e3

Please sign in to comment.