Add 10-second health logger and /_cron/tick endpoint

This commit is contained in:
Noah AI
2026-07-02 09:18:06 +00:00
parent 994040e004
commit cd11eac976
3 changed files with 20 additions and 1 deletions

View File

@@ -18,6 +18,21 @@ const apiRoot = config.apiPrefix || '/';
app.use(apiRoot, createHealthRouter(config));
app.use(apiRoot, createTodosRouter(config, db));
// 10-second health check logger
setInterval(() => {
console.log('[Health Check] Sandbox is healthy at ' + new Date().toISOString());
}, 10000);
app.post('/_cron/tick', (req, res) => {
const authHeader = req.headers.authorization;
if (!authHeader || authHeader !== 'Bearer ' + process.env.CRON_TOKEN) {
return res.status(401).json({ success: false, error: 'Unauthorized' });
}
console.log('[Tick] Cloud Run cron tick triggered.');
res.status(200).json({ success: true });
});
app.use((_req, res) => {
res.status(404).json({ success: false, error: 'Not found' });
});