feat: allow customizing history json filename
This commit is contained in:
@@ -5,8 +5,8 @@ const MAX_ITEMS = 1000; // max entries in history
|
||||
const TRUNCATE_AMOUNT = 200; // count of entries to remove when max is hit
|
||||
|
||||
export default class History {
|
||||
constructor() {
|
||||
this.filePath = path.resolve('data', 'history.json');
|
||||
constructor(filename = 'history.json') {
|
||||
this.filePath = path.resolve('data', filename);
|
||||
try {
|
||||
const data = fs.readFileSync(this.filePath);
|
||||
this.db = data.length === 0 ? [] : JSON.parse(data);
|
||||
|
||||
Reference in New Issue
Block a user