refactor(app.ts): move cron function and startFirehose function to startup.ts

This commit is contained in:
P. Reis 2024-07-24 10:55:30 -03:00
parent 23bb24929c
commit ddd1972c83

View file

@ -5,9 +5,6 @@ import { logger } from '@hono/hono/logger';
import { NostrEvent, NostrSigner, NStore, NUploader } from '@nostrify/nostrify';
import Debug from '@soapbox/stickynotes/debug';
import { Conf } from '@/config.ts';
import { cron } from '@/cron.ts';
import { startFirehose } from '@/firehose.ts';
import { Time } from '@/utils/time.ts';
import {
@ -145,13 +142,6 @@ const app = new Hono<AppEnv>({ strict: false });
const debug = Debug('ditto:http');
if (Conf.firehoseEnabled) {
startFirehose();
}
if (Conf.cronEnabled) {
cron();
}
app.use('*', rateLimitMiddleware(300, Time.minutes(5)));
app.use('/api/*', metricsMiddleware, logger(debug));