File: //var/dev/farhangmoaser/web/config.js
'use strict';
var fs = require('fs');
var deepAssign = require('deep-assign');
var confs = JSON.parse(fs.readFileSync(__dirname+'/config.json').toString());
class Config {
  constructor(env) {
    this.env = env;
  }
  read(path) {
    var conf = confs[env];
    if(!path) return conf;
    try {
      path.split('.').forEach(key => conf = conf[key])
      return conf;
    }catch(e) {
      return null;
    }
  }
  write(_confs){
  	confs[global.env] = deepAssign(confs[global.env], _confs);
  	fs.writeFileSync('config.json', JSON.stringify(confs, null, 2));
  }
}
global.env = global.env || process.env.FM_ENV || "production";
// module.exports = confs[global.env];
module.exports = new Config(env);