feat: protect github route with secret too
Node.js CI / Lint and Test (push) Successful in 44s

This commit is contained in:
2025-08-27 19:04:06 -07:00
parent d5c0abe4d8
commit 994f50c174
3 changed files with 30 additions and 14 deletions
+14 -10
View File
@@ -57,6 +57,7 @@ const html = `<!DOCTYPE html>
* Starts up a web server for health monitoring.
* @param amari - Amari's instance.
*/
// eslint-disable-next-line max-lines-per-function -- STFU.
export const instantiateServer = (amari: Amari): void => {
try {
const server = fastify({
@@ -68,18 +69,21 @@ export const instantiateServer = (amari: Amari): void => {
response.send(html);
});
server.
server.post<{
// eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify standard.
Body: GithubPayload;
// eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify standard.
post<{ Body: GithubPayload }>("/github", async(request, response) => {
try {
await processGithubEvent(amari, request, response);
} catch (error) {
if (!(error instanceof Error)) {
return;
}
await logger.error("/github route", error);
Querystring: { secret: string };
}>("/github", async(request, response) => {
try {
await processGithubEvent(amari, request, response);
} catch (error) {
if (!(error instanceof Error)) {
return;
}
});
await logger.error("/github route", error);
}
});
server.
// eslint-disable-next-line @typescript-eslint/naming-convention -- Fastify standard.