import fp from "fastify-plugin";
import { PostHog } from "posthog-node";
const posthogPlugin = async (fastify, opts) => {
    const postHog = new PostHog(opts.apiKey, {
        host: "https://app.posthog.com",
    });
    fastify.decorate("postHog", postHog);
    fastify.addHook("onClose", () => {
        postHog.shutdown();
    });
};
export default fp(posthogPlugin);
//# sourceMappingURL=posthog.js.map