Skip to content

Commit e994210

Browse files
committed
chore(rivetkit): allow speciying custom path for createFIleSystemDriver (#3517)
1 parent db0a54f commit e994210

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

rivetkit-typescript/packages/rivetkit/src/drivers/file-system/global-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class FileSystemGlobalState {
110110

111111
constructor(persist: boolean = true, customPath?: string) {
112112
this.#persist = persist;
113-
this.#storagePath = persist ? getStoragePath(customPath) : "/tmp";
113+
this.#storagePath = persist ? (customPath ?? getStoragePath()) : "/tmp";
114114
const path = getNodePath();
115115
this.#stateDir = path.join(this.#storagePath, "state");
116116
this.#dbsDir = path.join(this.#storagePath, "databases");

rivetkit-typescript/packages/rivetkit/src/drivers/file-system/utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ function createHashForPath(dirPath: string): string {
5050
/**
5151
* Get the storage path for the current working directory or a specified path
5252
*/
53-
export function getStoragePath(customPath?: string): string {
53+
export function getStoragePath(): string {
5454
const dataPath = getDataPath("rivetkit");
55-
const pathToHash = customPath || process.cwd();
56-
const dirHash = createHashForPath(pathToHash);
55+
const dirHash = createHashForPath(process.cwd());
5756
const path = getNodePath();
5857
return path.join(dataPath, dirHash);
5958
}

rivetkit-typescript/packages/rivetkit/src/mod.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ export {
77
export { InlineWebSocketAdapter } from "@/common/inline-websocket-adapter";
88
export { noopNext } from "@/common/utils";
99
export { createEngineDriver } from "@/drivers/engine/mod";
10-
// export {
11-
// createFileSystemDriver,
12-
// createMemoryDriver,
13-
// } from "@/drivers/file-system/mod";
10+
export {
11+
createFileSystemDriver,
12+
createMemoryDriver,
13+
} from "@/drivers/file-system/mod";
1414
export type { ActorQuery } from "@/manager/protocol/query";
1515
export * from "@/registry/mod";
1616
export { toUint8Array } from "@/utils";

0 commit comments

Comments
 (0)