mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
27 lines
565 B
JavaScript
27 lines
565 B
JavaScript
const os = require('os');
|
|
const path = require('path');
|
|
const { writeFile } = require('frappejs/server/utils');
|
|
|
|
const homedir = os.homedir();
|
|
const configFilePath = path.join(homedir, '.config', 'frappe-accounting', 'settings.json');
|
|
|
|
function getSettings() {
|
|
let settings;
|
|
try {
|
|
settings = require(configFilePath);
|
|
} catch (e) {
|
|
settings = {}
|
|
}
|
|
|
|
return settings;
|
|
}
|
|
|
|
async function saveSettings(settings) {
|
|
await writeFile(configFilePath, JSON.stringify(settings));
|
|
}
|
|
|
|
module.exports = {
|
|
getSettings,
|
|
saveSettings
|
|
}
|