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.
skynet-webportal/packages/health-check/src/db.js

13 lines
377 B
JavaScript
Raw Normal View History

2020-09-09 12:25:00 +00:00
const fs = require("fs");
const low = require("lowdb");
const FileSync = require("lowdb/adapters/FileSync");
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-01-26 11:18:40 +00:00
const adapter = new FileSync(`${process.env.STATE_DIR}/state.json`);
const db = low(adapter);
2020-09-10 10:15:54 +00:00
db.defaults({ disabled: false, critical: [], verbose: [] }).write();
module.exports = db;