From 3f4827ae20eeff024a94810e1d2b66e5d0241a81 Mon Sep 17 00:00:00 2001 From: Xevion Date: Thu, 9 Mar 2023 19:17:44 -0600 Subject: [PATCH] Allow disabling monitor reporting in production with query parameter --- src/pages/api/cron.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/api/cron.ts b/src/pages/api/cron.ts index 072744a..15298cd 100644 --- a/src/pages/api/cron.ts +++ b/src/pages/api/cron.ts @@ -5,7 +5,7 @@ import { getDistance } from '@/location'; import { env } from '@/env/server.mjs'; import monitorAsync from '@/monitor'; import { sendNotification } from '@/notify'; -import { fetchConfiguration, checkIdentifier, markIdentifier } from '@/db'; +import { checkIdentifier, fetchConfiguration, markIdentifier } from '@/db'; import { localNow } from '@/utils/timezone'; type ResponseData = { @@ -67,7 +67,10 @@ export default async function handler( try { let result; - if (process.env.NODE_ENV === 'production') + if ( + process.env.NODE_ENV === 'production' && + (req.query.report ?? 'true') === 'true' + ) result = await monitorAsync(innerFunction); else result = await innerFunction(); res.status(200).json({ status: result.status, key: result.key });