Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SENDGRID_API_KEY=your-sendgrid-api-key
RESEND_API_KEY=your-resend-api-key
FROM_EMAIL=governify.auditor@gmail.com
PORT=6100
2 changes: 0 additions & 2 deletions .github/workflows/dockerversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Create Release and Push to DockerHub
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
test:
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM node:21-alpine

COPY . .

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

ARG PORT=80
ENV PORT $PORT
EXPOSE $PORT
Expand Down
2 changes: 1 addition & 1 deletion appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ dotenv.config();
export default {
port: process.env.PORT || 6100,
fromEmail: process.env.FROM_EMAIL,
sendgridApiKey: process.env.SENDGRID_API_KEY,
resendApiKey: process.env.RESEND_API_KEY,
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import appConfig from "./appConfig.js";
dotenv.config();

const app = express();
app.use(express.json());
app.use(express.json({ limit: '50mb' }));

// Load OpenAPI Specification
const swaggerDocument = yaml.load("./api/oas-notification.yaml");
Expand Down
149 changes: 102 additions & 47 deletions 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
Expand Up @@ -26,13 +26,13 @@
},
"homepage": "https://github.com/governify/notificator#readme",
"dependencies": {
"@sendgrid/mail": "^8.1.4",
"axios": "^1.4.0",
"dotenv": "^16.4.7",
"express": "^4.18.2",
"express-validator": "^7.2.1",
"marked": "^4.3.0",
"nodemon": "^3.1.9",
"resend": "^6.5.2",
"slackify-markdown": "^4.4.0",
"swagger-ui-express": "^5.0.1",
"yamljs": "^0.3.0"
Expand Down
29 changes: 17 additions & 12 deletions services/emailService.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import sgMail from "@sendgrid/mail";
import { Resend } from 'resend';
import appConfig from "../appConfig.js";
const SENDGRID_API_KEY = appConfig.sendgridApiKey;
const RESEND_API_KEY = appConfig.resendApiKey;
const FROM = appConfig.fromEmail;

sgMail.setApiKey(SENDGRID_API_KEY);
const resend = new Resend(RESEND_API_KEY);

export const sendEmail = async (to, subject, text, html) => {
const msg = {
to,
from: FROM,
subject,
text,
html,
};

await sgMail.send(msg);
const message = {
to: to,
from: FROM,
subject,
text,
html,
}
const { data, error } = await resend.emails.send(message);
if (error) {
return console.error({ error });
}
console.log({ data });
};


Loading