var fs = require('fs');

var Settings = {};

Settings.init = function (){};

Settings.get = function (key){
  var tokenFileName = process.env.HOME + '/.unidisk/' + key;
  var value;
  try {
    var stats = fs.statSync(tokenFileName);
    value = stats.isFile() ? fs.readFileSync( tokenFileName ) : null;
  } catch (e) {
    value = null;
  }
  return value;
};

Settings.set = function (key, value){

};

module.exports = Settings;

var fs = require('fs');

var Settings = {};

Settings.init = function (){};

Settings.get = function (key){
  if (this.table) {
    return this.table[key];
  }

  var settingsFileName = process.env.HOME + '/.unidisk/' + 'settings.json';
  try {
    var stats = fs.statSync(settingsFileName);
    var value = stats.isFile() ? fs.readFileSync( settingsFileName ) : {};
    this.table = JSON.parse(value);
  } catch (e) {
    console.error('failed to load settings');
    this.table = {};
  }
  return this.table[key];
};

Settings.set = function (key, value){

};

module.exports = Settings;

Integrate all settings into settings.json file.
Integrate all settings into settings.json file.
