Skip to content

Instantly share code, notes, and snippets.

@SomeKay
Created August 8, 2015 00:18
Show Gist options
  • Save SomeKay/54598153b65bf4b832c2 to your computer and use it in GitHub Desktop.
Save SomeKay/54598153b65bf4b832c2 to your computer and use it in GitHub Desktop.
'use strict';
var nconf = require('nconf').file({file: getUserHome() + '/sound-machine-config.json'});
function saveSettings(settingKey, settingValue) {
nconf.set(settingKey, settingValue);
nconf.save();
}
function readSettings(settingKey) {
nconf.load();
return nconf.get(settingKey);
}
function getUserHome() {
return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
}
module.exports = {
saveSettings: saveSettings,
readSettings: readSettings
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment