diff options
author | Linnnus <[email protected]> | 2025-02-22 06:50:02 +0100 |
---|---|---|
committer | Linnnus <[email protected]> | 2025-02-22 06:50:02 +0100 |
commit | 6412f46a45d3b66c85c0cc3952206ad9cca0a110 (patch) | |
tree | 903016674595a980e2f443aec075d9c92a36c205 /app/src/lib/server/beanstalkd.ts | |
parent | b42bfa3abcd29cb977fbdc41a02d9f7f1ffeb1a2 (diff) |
Add watermarking service, fix everything
Diffstat (limited to 'app/src/lib/server/beanstalkd.ts')
-rw-r--r-- | app/src/lib/server/beanstalkd.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/src/lib/server/beanstalkd.ts b/app/src/lib/server/beanstalkd.ts new file mode 100644 index 0000000..10f392a --- /dev/null +++ b/app/src/lib/server/beanstalkd.ts @@ -0,0 +1,19 @@ +import pkg from "beanstalkd"; +import type { Handle } from "@sveltejs/kit"; + +// Annoying CommonJS interop issue (vitejs/vite#2139) which combines with incorrect typings from DefinitelyTyped project :( +// @ts-ignore +const BeanstalkdClient = pkg.default as typeof pkg; + +export const beanstalkdHandle = (async ({ event, resolve }) => { + // FIXME: Should obv. read from env. + const beanstalkdClient = new BeanstalkdClient("localhost", 11300); + await beanstalkdClient.connect(); + + event.locals.beanstalkdClient = beanstalkdClient; + try { + return await resolve(event); + } finally { + beanstalkdClient.quit(); + } +}) satisfies Handle; |