Files
GibSend/apps/web/src/instrumentation.ts
KM Koushik 403ad8b93e add stripe (#121)
* add some stripe stuff

* more stripe stuff

* more stripe things

* more stripr stuff

* more stripe stuff

* more stripe stuff

* add more stuff

* add more stripe stuff

* more stuff

* fix types
2025-03-23 07:06:56 +11:00

31 lines
766 B
TypeScript

import { env } from "./env";
import { isCloud } from "./utils/common";
let initialized = false;
/**
* Add things here to be executed during server startup.
*
* more details here: https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation
*/
export async function register() {
// eslint-disable-next-line turbo/no-undeclared-env-vars
if (process.env.NEXT_RUNTIME === "nodejs" && !initialized) {
console.log("Registering instrumentation");
const { EmailQueueService } = await import(
"~/server/service/email-queue-service"
);
await EmailQueueService.init();
/**
* Send usage data to Stripe
*/
if (isCloud()) {
await import("~/server/jobs/usage-job");
}
initialized = true;
}
}