Files
switchmon/config.js
2016-03-01 23:38:24 +01:00

22 lines
438 B
JavaScript

'use strict';
const configPath = require('xdg').basedir.configPath('switchmon/config.json');
const defaults = {
postCmd: undefined,
profiles: {},
};
let config = Object.assign({}, defaults);
try {
config = Object.assign(config, require(configPath));
} catch(err) {
if (err.code !== 'MODULE_NOT_FOUND') {
throw err;
}
// No config found in "${configPath}". Using defaults...
}
module.exports = config;