From 2587225b95737ff793a89d1b3fb7052335feb5e0 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 16 Jan 2023 21:52:50 +0000 Subject: [PATCH] feat: add support for memory storage driver --- server/shared.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/shared.ts b/server/shared.ts index 6fd82fb1..06d5a11a 100644 --- a/server/shared.ts +++ b/server/shared.ts @@ -2,6 +2,8 @@ import _fs from 'unstorage/drivers/fs' // @ts-expect-error unstorage needs to provide backwards-compatible subpath types import _kv from 'unstorage/drivers/cloudflare-kv-http' +// @ts-expect-error unstorage needs to provide backwards-compatible subpath types +import _memory from 'unstorage/drivers/memory' import { stringifyQuery } from 'ufo' @@ -17,6 +19,7 @@ const config = useRuntimeConfig() const fs = _fs as typeof import('unstorage/dist/drivers/fs')['default'] const kv = _kv as typeof import('unstorage/dist/drivers/cloudflare-kv-http')['default'] +const memory = _memory as typeof import('unstorage/dist/drivers/memory')['default'] const storage = useStorage() as Storage @@ -30,6 +33,9 @@ else if (config.storage.driver === 'cloudflare') { apiToken: config.cloudflare.apiToken, }))) } +else if (config.storage.driver === 'memory') { + storage.mount('servers', memory()) +} export function getRedirectURI(origin: string, server: string) { return `${origin}/api/${server}/oauth?${stringifyQuery({ origin })}`