Skip to content

Commit

Permalink
Shorten example queue URL env var
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorr committed Nov 12, 2022
1 parent 453edc8 commit acc7fce
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
AWS_PROFILE=default
AWS_REGION=us-east-1
AWS_SQS_INDEX_QUEUE_URL=
AWS_SQS_QUEUE_URL=
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ npm install sqs-reader
```ts
import { SQSReader } from 'sqs-reader';

const { AWS_SQS_INDEX_QUEUE_URL } = process.env;
const { AWS_SQS_QUEUE_URL } = process.env;

if (!AWS_SQS_INDEX_QUEUE_URL) {
throw new Error('AWS_SQS_INDEX_QUEUE_URL is not configured');
if (!AWS_SQS_QUEUE_URL) {
throw new Error('AWS_SQS_QUEUE_URL is not configured');
}

const queueReader = new SQSReader(AWS_SQS_INDEX_QUEUE_URL, async (message) => {
const queueReader = new SQSReader(AWS_SQS_QUEUE_URL, async (message) => {
console.log('Received message', message.MessageId);
});

Expand Down
8 changes: 4 additions & 4 deletions test/basic.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import sleep from 'sleep-cancel';
import { SQSReader } from '../src';

const { AWS_SQS_INDEX_QUEUE_URL } = process.env;
const { AWS_SQS_QUEUE_URL } = process.env;

if (!AWS_SQS_INDEX_QUEUE_URL) {
throw new Error('AWS_SQS_INDEX_QUEUE_URL is not configured');
if (!AWS_SQS_QUEUE_URL) {
throw new Error('AWS_SQS_QUEUE_URL is not configured');
}

const queueReader = new SQSReader(AWS_SQS_INDEX_QUEUE_URL, async (message) => {
const queueReader = new SQSReader(AWS_SQS_QUEUE_URL, async (message) => {
console.log('Received message', message.MessageId);
});

Expand Down
16 changes: 8 additions & 8 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { expect } from 'chai';
import crypto from 'crypto';
import { SQSReader } from '../src';

const { AWS_SQS_INDEX_QUEUE_URL } = process.env;
const { AWS_SQS_QUEUE_URL } = process.env;

if (!AWS_SQS_INDEX_QUEUE_URL) {
throw new Error('AWS_SQS_INDEX_QUEUE_URL is not configured');
if (!AWS_SQS_QUEUE_URL) {
throw new Error('AWS_SQS_QUEUE_URL is not configured');
}

const sqs = new SQS({ apiVersion: '2012-11-05' });
Expand All @@ -32,7 +32,7 @@ describe('SQSReader', function () {
const barrier = makeBarrier();
let receivedId;
let receivedBody;
const queueReader = new SQSReader(AWS_SQS_INDEX_QUEUE_URL, async (message) => {
const queueReader = new SQSReader(AWS_SQS_QUEUE_URL, async (message) => {
receivedId = message.MessageId;
receivedBody = message.Body;
if (receivedBody === sentBody) {
Expand All @@ -46,7 +46,7 @@ describe('SQSReader', function () {

const sendResult = await sqs
.sendMessage({
QueueUrl: AWS_SQS_INDEX_QUEUE_URL,
QueueUrl: AWS_SQS_QUEUE_URL,
MessageBody: sentBody,
})
.promise();
Expand All @@ -73,7 +73,7 @@ describe('SQSReader', function () {
});

const queueReader = new SQSReader(
AWS_SQS_INDEX_QUEUE_URL,
AWS_SQS_QUEUE_URL,
async (message) => {
// ignore unexpected messages in case there is pending junk in the queue
console.log(`Received unexpected message ${message.MessageId}: ${message.Body}`);
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('SQSReader', function () {
let receivedId;
let receivedBody;
const queueReader = new SQSReader(
AWS_SQS_INDEX_QUEUE_URL,
AWS_SQS_QUEUE_URL,
async (message) => {
receivedId = message.MessageId;
receivedBody = message.Body;
Expand All @@ -129,7 +129,7 @@ describe('SQSReader', function () {

const sendResult = await sqs
.sendMessage({
QueueUrl: AWS_SQS_INDEX_QUEUE_URL,
QueueUrl: AWS_SQS_QUEUE_URL,
MessageBody: sentBody,
})
.promise();
Expand Down

0 comments on commit acc7fce

Please sign in to comment.