Skip to content

Commit 589858f

Browse files
committed
refactor: adjust environment variables
Signed-off-by: Matheus Cruz <[email protected]>
1 parent 816ee58 commit 589858f

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ docker-compose up -d
7777
### Execute the whatsapp application
7878

7979
> [!NOTE]
80-
> Before you start, make sure to fill the `ALLOWED_USERS` and `OPENAI_API_KEY` variables in the `.env.local` file. This variable determines the number of users who can interact with the bot.
80+
> Before you start, make sure to fill the `ALLOWED_PHONE_NUMBERS` and `OPENAI_API_KEY` variables in the `.env.local` file. This variable determines the number of users who can interact with the bot.
8181
8282
1. Go to `whatsapp` directory and install all necessary packages:
8383

RUNNING_TERRAFORM_AWS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ AWS_SECRET_ACCESS_KEY=
5757
OPENAI_API_KEY=
5858
SECURITY_KEY=
5959
INCOMING_MESSAGE_FIFO_URL=
60-
MESSAGES_PROCESSED_FIFO_URL=
60+
RECOGNIZED_MESSAGES_FIFO_URL=
6161
EOF
6262
```
6363

@@ -73,7 +73,7 @@ The table below explains the purpose of each variable along with suggested examp
7373
| `OPENAI_API_KEY` | Your OpenAI API key | `sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
7474
| `SECURITY_KEY` | Secret key used for AES encryption (must be exactly 16, 24, or 32 characters long, no accents) | `MySuperSecretAESKey12345678901234` |
7575
| `INCOMING_MESSAGE_FIFO_URL` | The URL of the SQS FIFO queue for incoming messages | `https://sqs.us-east-1.amazonaws.com/123456789/incoming-messages.fifo` |
76-
| `MESSAGES_PROCESSED_FIFO_URL`| The URL of the SQS FIFO queue for processed messages | `https://sqs.us-east-1.amazonaws.com/123456789/messages-processed.fifo` |
76+
| `RECOGNIZED_MESSAGES_FIFO_URL`| The URL of the SQS FIFO queue for processed messages | `https://sqs.us-east-1.amazonaws.com/123456789/messages-processed.fifo` |
7777

7878
4. Execute the application in Dev mode
7979

@@ -85,7 +85,7 @@ The table below explains the purpose of each variable along with suggested examp
8585

8686
6. Sign in at <http://localhost:8080>
8787

88-
7. Add the user phone number at <http://localhost:8080/home/user-configs>, this phone number must be set after on `ALLOWED_USERS`.
88+
7. Add the user phone number at <http://localhost:8080/home/user-configs>, this phone number must be set after on `ALLOWED_PHONE_NUMBERS`.
8989

9090
## Configuring and running the whatsapp application
9191

@@ -104,10 +104,10 @@ npm install
104104
| `AWS_ACCESS_KEY_ID` | Your AWS Access Key | `AKIAxxxxxxxxxxxxxxxxxx` |
105105
| `AWS_SECRET_ACCESS_KEY` | Your AWS Secret Key | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
106106
| `ASSETS_BUCKET` | The name of the bucket where audio and images will be stored (created via Terraform) | `my-assets-bucket` |
107-
| `ALLOWED_USERS` | Comma-separated list of phone numbers allowed to interact with the bot | `5511999999999,5511888888888` |
107+
| `ALLOWED_PHONE_NUMBERS` | Comma-separated list of phone numbers allowed to interact with the bot | `5511999999999,5511888888888` |
108108
| `OPENAI_API_KEY` | Your OpenAI API Key used to access GPT and Whisper APIs | `sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
109109
| `INCOMING_MESSAGE_QUEUE` | URL of the SQS queue that receives incoming messages | `https://sqs.us-east-1.amazonaws.com/123456789/incoming-messages.fifo` |
110-
| `MESSAGES_PROCESSED_FIFO_URL`| URL of the SQS FIFO queue where processed messages are sent | `https://sqs.us-east-1.amazonaws.com/123456789/messages-processed.fifo` |
110+
| `RECOGNIZED_MESSAGES_FIFO_URL`| URL of the SQS FIFO queue where processed messages are sent | `https://sqs.us-east-1.amazonaws.com/123456789/messages-processed.fifo` |
111111

112112
4. Start the application
113113

@@ -127,7 +127,7 @@ npm run start
127127
2. Fill out the registration form with your details and submit it.
128128
3. Log in to your account at [http://localhost:8080](http://localhost:8080).
129129
4. Add your phone number on the [User Configs page](http://localhost:8080/home/user-configs).
130-
⚠️ Make sure the phone number matches one of the values defined in the `ALLOWED_USERS` environment variable.
130+
⚠️ Make sure the phone number matches one of the values defined in the `ALLOWED_PHONE_NUMBERS` environment variable.
131131
5. After connected the device with the scanned QR Code, send the following message: `"Achei mil reais no chão da praia"`.
132132

133133
You should receive something like it:

timeless-api/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ ASSETS_BUCKET=
44
OPENAI_API_KEY=
55
SECURITY_KEY=
66
INCOMING_MESSAGE_FIFO_URL=
7-
MESSAGES_PROCESSED_FIFO_URL=
7+
RECOGNIZED_MESSAGES_FIFO_URL=

timeless-api/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ security.sensible.secret=${SECURITY_KEY}
33
%dev.security.sensible.secret=YS0xNi1ieXRlLXNlY3JldA==
44

55
whatsapp.incoming-messages.queue-url=${INCOMING_MESSAGE_FIFO_URL}
6-
whatsapp.messages-processed.queue-url=${MESSAGES_PROCESSED_FIFO_URL}
6+
whatsapp.messages-processed.queue-url=${RECOGNIZED_MESSAGES_FIFO_URL}
77

88
# aws sqs
99
quarkus.sqs.devservices.enabled=false

whatsapp/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AWS_ACCESS_KEY_ID=
22
AWS_SECRET_ACCESS_KEY=
33
AWS_REGION=
44
ASSETS_BUCKET=
5-
ALLOWED_USERS=
5+
ALLOWED_PHONE_NUMBERS=
66
OPENAI_API_KEY=
77
INCOMING_MESSAGE_FIFO_URL=
8-
MESSAGES_PROCESSED_FIFO_URL=
8+
RECOGNIZED_MESSAGES_FIFO_URL=

whatsapp/.env.local

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ AWS_SECRET_ACCESS_KEY=test
33
AWS_REGION=us-east-1
44
ASSETS_BUCKET=timeless-local-assets
55
INCOMING_MESSAGE_FIFO_URL=http://localhost:4566/000000000000/incoming-messages.fifo
6-
MESSAGES_PROCESSED_FIFO_URL=http://localhost:4566/000000000000/messages-processed.fifo
7-
ALLOWED_USERS=
6+
RECOGNIZED_MESSAGES_FIFO_URL=http://localhost:4566/000000000000/messages-processed.fifo
7+
ALLOWED_PHONE_NUMBERS=
88
OPENAI_API_KEY=

whatsapp/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const messages = {
7171
}
7272

7373
const getAllowedUsers = () =>
74-
process.env.ALLOWED_USERS.split(",").filter(Boolean)
74+
process.env.ALLOWED_PHONE_NUMBERS.split(",").filter(Boolean)
7575

7676
const client = new Client({
7777
clientId: "timeless-bot",
@@ -264,7 +264,7 @@ async function uploadMediaToS3(message, media) {
264264
}
265265

266266
const consumer = Consumer.create({
267-
queueUrl: process.env.MESSAGES_PROCESSED_FIFO_URL,
267+
queueUrl: process.env.RECOGNIZED_MESSAGES_FIFO_URL,
268268
sqs: sqsClient,
269269
suppressFifoWarning: true,
270270
handleMessage: async (sqsMessage) => {

0 commit comments

Comments
 (0)