Skip to content

Commit 356702b

Browse files
committed
Hide local endpoints when deployed
1 parent e72ce53 commit 356702b

1 file changed

Lines changed: 25 additions & 23 deletions

File tree

backend/api/src/app.ts

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -464,33 +464,35 @@ swaggerDocument.paths["/internal/send-search-notifications"] = {
464464
},
465465
} as any
466466

467+
467468
// Local Endpoints
468-
app.post(pathWithPrefix("/local/send-test-email"),
469-
async (req, res) => {
470-
if (!IS_LOCAL) {
471-
return res.status(401).json({error: "Unauthorized"});
472-
}
469+
if (IS_LOCAL) {
470+
app.post(pathWithPrefix("/local/send-test-email"),
471+
async (req, res) => {
472+
if (!IS_LOCAL) {
473+
return res.status(401).json({error: "Unauthorized"});
474+
}
473475

474-
try {
475-
const result = await localSendTestEmail()
476-
return res.status(200).json(result)
477-
} catch (err) {
478-
return res.status(500).json({error: err});
476+
try {
477+
const result = await localSendTestEmail()
478+
return res.status(200).json(result)
479+
} catch (err) {
480+
return res.status(500).json({error: err});
481+
}
479482
}
480-
}
481-
);
482-
483-
swaggerDocument.paths["/local/send-test-email"] = {
484-
post: {
485-
summary: "Send a test email",
486-
description: "Local endpoint to send a test email.",
487-
tags: ["Local"],
488-
requestBody: {
489-
required: false,
483+
);
484+
swaggerDocument.paths["/local/send-test-email"] = {
485+
post: {
486+
summary: "Send a test email",
487+
description: "Local endpoint to send a test email.",
488+
tags: ["Local"],
489+
requestBody: {
490+
required: false,
491+
},
492+
responses: responses,
490493
},
491-
responses: responses,
492-
},
493-
} as any
494+
} as any
495+
}
494496

495497

496498
const rootPath = pathWithPrefix("/")

0 commit comments

Comments
 (0)