Skip to content

Commit

Permalink
feat: add env vars and twilio integration
Browse files Browse the repository at this point in the history
  • Loading branch information
saifali96 committed May 6, 2022
1 parent c8a5465 commit 8ac7c2f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
images
images
.env
10 changes: 6 additions & 4 deletions config/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const MONGO_URI = "mongodb://localhost:27017/node_mono_latest";
export const JWT_SECRET = "Sup3rs4f3_JWT_S33cr3t!";
import 'dotenv/config';
export const MONGO_URI = `${process.env.MONGO_URI}`;
export const JWT_SECRET = `${process.env.JWT_SECRET}`;

export const TWILIO_ACCT_SID = "";
export const TWILIO_AUTH_TOKEN = "";
export const TWILIO_ACCT_SID = `${process.env.TWILIO_ACCT_SID}`;
export const TWILIO_AUTH_TOKEN = `${process.env.TWILIO_AUTH_TOKEN}`;
export const TWILIO_FROM_NUMBER = `${process.env.TWILIO_FROM_NUMBER}`;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"cors": "^2.8.5",
"dotenv": "^16.0.0",
"express": "^4.18.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.3.1",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

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

6 changes: 2 additions & 4 deletions utilities/NotificationUtility.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TWILIO_ACCT_SID, TWILIO_AUTH_TOKEN } from "../config";
import { TWILIO_ACCT_SID, TWILIO_AUTH_TOKEN, TWILIO_FROM_NUMBER } from "../config";

// Email

Expand All @@ -15,14 +15,12 @@ export const GenerateOtp = () => {
}

export const onRequestOTP = async (otp: number, to: string) => {

// TODO - Add Twilio API integration

// const twilioClient = require("twilio")(TWILIO_ACCT_SID, TWILIO_AUTH_TOKEN);

// const response = await twilioClient.messages.create({
// body: `Your OTP is ${otp}`,
// from: '',
// from: `${TWILIO_FROM_NUMBER}`,
// to
// });

Expand Down

0 comments on commit 8ac7c2f

Please sign in to comment.