From 208aad103a61f5e8fee83ecd1e6577bde6c9c6b9 Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Thu, 20 Nov 2025 20:57:34 -0800 Subject: [PATCH] chore(rivetkit): allow speciying custom path for createFIleSystemDriver --- .../rivetkit/src/drivers/file-system/global-state.ts | 2 +- .../packages/rivetkit/src/drivers/file-system/utils.ts | 5 ++--- rivetkit-typescript/packages/rivetkit/src/mod.ts | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/global-state.ts b/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/global-state.ts index 661588a34f..813850c135 100644 --- a/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/global-state.ts +++ b/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/global-state.ts @@ -110,7 +110,7 @@ export class FileSystemGlobalState { constructor(persist: boolean = true, customPath?: string) { this.#persist = persist; - this.#storagePath = persist ? getStoragePath(customPath) : "/tmp"; + this.#storagePath = persist ? (customPath ?? getStoragePath()) : "/tmp"; const path = getNodePath(); this.#stateDir = path.join(this.#storagePath, "state"); this.#dbsDir = path.join(this.#storagePath, "databases"); diff --git a/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/utils.ts b/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/utils.ts index 785aa4808d..8d0a77f546 100644 --- a/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/utils.ts +++ b/rivetkit-typescript/packages/rivetkit/src/drivers/file-system/utils.ts @@ -50,10 +50,9 @@ function createHashForPath(dirPath: string): string { /** * Get the storage path for the current working directory or a specified path */ -export function getStoragePath(customPath?: string): string { +export function getStoragePath(): string { const dataPath = getDataPath("rivetkit"); - const pathToHash = customPath || process.cwd(); - const dirHash = createHashForPath(pathToHash); + const dirHash = createHashForPath(process.cwd()); const path = getNodePath(); return path.join(dataPath, dirHash); } diff --git a/rivetkit-typescript/packages/rivetkit/src/mod.ts b/rivetkit-typescript/packages/rivetkit/src/mod.ts index 469c6beb90..324d375bdd 100644 --- a/rivetkit-typescript/packages/rivetkit/src/mod.ts +++ b/rivetkit-typescript/packages/rivetkit/src/mod.ts @@ -7,10 +7,10 @@ export { export { InlineWebSocketAdapter } from "@/common/inline-websocket-adapter"; export { noopNext } from "@/common/utils"; export { createEngineDriver } from "@/drivers/engine/mod"; -// export { -// createFileSystemDriver, -// createMemoryDriver, -// } from "@/drivers/file-system/mod"; +export { + createFileSystemDriver, + createMemoryDriver, +} from "@/drivers/file-system/mod"; export type { ActorQuery } from "@/manager/protocol/query"; export * from "@/registry/mod"; export { toUint8Array } from "@/utils";