code: function readConfig(file) {
    var home = process.env.HOME
      , conf = {}
      , dir
      , json;
  
    if (file || options.config) {
      file = path.resolve(process.cwd(), file || options.config);
      dir = path.dirname(file);
      json = options.config;
    } else {
      dir = process.env.TTYJS_PATH || path.join(home, '.tty.js');
      json = path.join(dir, 'config.json');
    }
  
    if (exists(dir) && exists(json)) {
      if (!fs.statSync(dir).isDirectory()) {
        json = dir;
        dir = home;
      }
  
      conf = JSON.parse(fs.readFileSync(json, 'utf8'));
    } else {
      if (!exists(dir)) {
        fs.mkdirSync(dir, 0700);
      }
  
      fs.writeFileSync(json, JSON.stringify(conf, null, 2));
      fs.chmodSync(json, 0600);
    }
  
    // expose paths
    conf.dir = dir;
    conf.json = json;
  
    // flag
    conf.__read = true;
  
    return checkConfig(conf);
  }
docs: Read Config