This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
2021-04-29 14:56:53 +00:00
|
|
|
const fs = require("graceful-fs");
|
2020-06-22 09:54:01 +00:00
|
|
|
const low = require("lowdb");
|
2021-04-29 14:56:53 +00:00
|
|
|
const FileSyncAtomic = require("./adapters/FileSyncAtomic");
|
2020-06-22 09:54:01 +00:00
|
|
|
|
2021-01-26 11:18:40 +00:00
|
|
|
if (!fs.existsSync(process.env.STATE_DIR)) fs.mkdirSync(process.env.STATE_DIR);
|
2020-09-09 12:25:00 +00:00
|
|
|
|
2021-04-29 14:56:53 +00:00
|
|
|
const adapter = new FileSyncAtomic(`${process.env.STATE_DIR}/state.json`);
|
2020-06-22 09:54:01 +00:00
|
|
|
const db = low(adapter);
|
|
|
|
|
2021-04-29 11:43:40 +00:00
|
|
|
db.defaults({ disabled: false, critical: [], extended: [] }).write();
|
2020-06-22 09:54:01 +00:00
|
|
|
|
|
|
|
module.exports = db;
|