Skip to content

Commit 14d2e57

Browse files
authored
Merge pull request #21 from LogicalGuy77/fix-env
Security Fix: Hardcoded API Key
2 parents 4b248ce + 41e8442 commit 14d2e57

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_BREVO_API_KEY=your_brevo_api_key_here

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ yarn-error.log*
2727
.pnpm-debug.log*
2828

2929
# local env files
30+
.env
3031
.env*.local
3132

3233
# vercel

utils/services/emailService.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import axios from "axios";
22
import { notify } from "./notification";
3-
const brevo_key = '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';
3+
4+
const brevo_key = process.env.NEXT_PUBLIC_BREVO_API_KEY;
45

56
export const sendEmail = async (email) => {
67
try {
8+
if (!brevo_key) {
9+
console.error("Brevo API key is not configured");
10+
notify("Email service configuration error", "error");
11+
return;
12+
}
13+
714
if (validateEmail(email)) {
815
const options = {
916
method: "POST",

0 commit comments

Comments
 (0)