hassio-nextcloud-backup/nextcloud_backup/rootfs/opt/nextcloud_backup/tools/settingsTools.js

27 lines
441 B
JavaScript

const fs = require('fs');
const settingsPath = "./conf.json"
function getSettings(){
if (!fs.existsSync(settingsPath)) {
return {};
}
else{
let rawSettings = fs.readFileSync(settingsPath);
return JSON.parse(rawSettings);
}
}
function setSettings(settings){
fs.writeFileSync(settingsPath, JSON.stringify(settings));
}
exports.getSettings = getSettings;
exports.setSettings = setSettings;