diff --git a/.env-example b/.env-example index 33aa8d9..70002ad 100644 --- a/.env-example +++ b/.env-example @@ -1,4 +1,10 @@ PORT=3001 ENVIRONMENT= MONGODB_DATABASE_URI= -ADMIN_TOKEN= \ No newline at end of file +ADMIN_TOKEN= +COMPANY= +SMTP_HOST= +SMTP_USER= +SMTP_PASS= +SMTP_MAIL= +SMTP_PORT= \ No newline at end of file diff --git a/README.md b/README.md index 4ed1639..b6d4945 100644 --- a/README.md +++ b/README.md @@ -59,11 +59,7 @@ This guide considers you have Node 16 or 18 installed and you are doing all thin ```bash nano .env ``` -##### Step 10 - Create a settings.json file and fill the required details from example settings.json in the repository -```bash - nano settings.json -``` -##### Step 11 - Run the API +##### Step 10 - Run the API ```bash node index.js ``` @@ -142,3 +138,5 @@ This guide considers you have Node 16 or 18 installed and you are doing all thin | Parameter | Type | Description | | :-------- | :------- | :-------------------------------- | | `discordId` | `string` | **Required**. Discord ID to assign VPS to. | + +### These API routes can change without being updated on every updated, check code for better infomation \ No newline at end of file diff --git a/settings.json.example b/settings.json.example deleted file mode 100644 index 0e4e5a6..0000000 --- a/settings.json.example +++ /dev/null @@ -1,10 +0,0 @@ -{ - "companyName": "Company Name goes here..", - "smtp": { - "host": "SMTP Host goes here", - "port": "SMTP Port goes here", - "user": "SMTP User goes here", - "pass": "SMTP Password goes here", - "mail": "SMTP Mail goes here" - } -} \ No newline at end of file diff --git a/src/routes/users/verify/index.ts b/src/routes/users/verify/index.ts index 2531d2a..5820d1e 100644 --- a/src/routes/users/verify/index.ts +++ b/src/routes/users/verify/index.ts @@ -2,7 +2,6 @@ import { config } from 'dotenv' import { Request, Response, Router } from "express"; import nodemailer from 'nodemailer'; import { DiscordAPI } from "../../../database/schemas"; -import { settingsParser } from '../../../services/settingsParser'; config(); const router = Router(); @@ -27,19 +26,18 @@ router.post('/mail', async(req: Request, res: Response) => { { verificationToken, verificationTokenExpiresAt: expiresAt } ); - const settings = settingsParser(); const transporter = nodemailer.createTransport({ - host: String(settings.smtp.host), - port: Number(settings.smtp.port), + host: String(process.env.SMTP_HOST), + port: Number(process.env.SMTP_PORT), secure: false, // upgrade later with STARTTLS auth: { - user: String(settings.smtp.user), - pass: String(settings.smtp.pass), + user: String(process.env.SMTP_USER), + pass: String(process.env.SMTP_PASS), }, }); const mailOptions = { - from: `${settings.companyName} <${settings.smtp.mail}>`, + from: `${process.env.COMPANY} <${process.env.SMTP_MAIL}>`, to: email, subject: 'Email Verification', text: `Your code for verification is: @@ -78,7 +76,7 @@ router.post('/mail', async(req: Request, res: Response) => {
Please use the verification code below to sign in.
${verificationToken}
If you didn’t request this, you can ignore this email.
-Thanks,
${settings.companyName}
Thanks,
${process.env.COMPANY}