Skip to content

Commit 6a5ec92

Browse files
committed
chore: add db scope suffix
1 parent 1a3aeaa commit 6a5ec92

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/server/src/third-party/y-websocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const wsReadyStateClosed = 3 // eslint-disable-line
2525

2626
// disable gc when using snapshots!
2727
const gcEnabled = process.env.GC !== 'false' && process.env.GC !== '0'
28-
const persistenceDir = `./.db${process.env.INSTANCE_NAME || ''}`
28+
const persistenceDir = `./.db-${process.env.INSTANCE_NAME || 'default'}`
2929
/**
3030
* @type {{bindState: function(string,WSSharedDoc):void, writeState:function(string,WSSharedDoc):Promise<any>, provider: any}|null}
3131
*/

packages/server/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from './third-party/y-websocket.js';
1313
import * as Y from 'yjs';
1414

15-
const instanceName = process.env.INSTANCE_NAME || '';
15+
const instanceName = process.env.INSTANCE_NAME || 'default';
1616
const docs = serverDocs as Map<string, Y.Doc>;
1717

1818
export interface AppContext {
@@ -44,7 +44,7 @@ async function initDB() {
4444
activeWorkspaceId?: string;
4545
workspaces: { id: string; rootId: string; name: string }[];
4646
} = { workspaces: [] };
47-
const db = await JSONFilePreset(`./.db${instanceName}/db.json`, defaultData);
47+
const db = await JSONFilePreset(`./.db-${instanceName}/db.json`, defaultData);
4848
await db.read();
4949
await db.write();
5050
return db;

0 commit comments

Comments
 (0)