Skip to content

Commit 988f203

Browse files
committed
Add setting for local database file path
1 parent 7663f44 commit 988f203

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@
8686
"description": "Author name for comments.",
8787
"default": "User"
8888
},
89+
"security-notes.localDatabase": {
90+
"type": "string",
91+
"description": "Local database file path.",
92+
"default": ".security-notes.json"
93+
},
8994
"security-notes.collab.enabled": {
9095
"type": "boolean",
9196
"description": "Enable collaboration via RethinkDB.",

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
syncNoteMapWithRemote,
1515
} from './helpers';
1616
import { RemoteDb } from './persistence/remote-db';
17-
import { loadCommentsFromFile, saveCommentsToFile } from './persistence/local';
17+
import { loadCommentsFromFile, saveCommentsToFile } from './persistence/local-db';
1818

1919
const noteMap = new Map<string, vscode.CommentThread>();
2020
let remoteDb: RemoteDb | undefined;
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import * as fs from 'fs';
44
import { Serializer } from '../serialization/serializer';
55
import { Deserializer } from '../serialization/deserializer';
6-
import { CommentThread, CommentThreadCollapsibleState } from 'vscode';
6+
import { CommentThread } from 'vscode';
7+
import { getSetting } from '../../helpers';
78

8-
const persistenceFile = '/tmp/.security-notes.json';
9+
const persistenceFile = getSetting('localDatabase');
910

1011
export const saveCommentsToFile = (noteList: Map<string, CommentThread>) => {
1112
fs.writeFileSync(persistenceFile, JSON.stringify(Serializer.serialize(noteList)));

0 commit comments

Comments
 (0)