var path       = require('path');
var settings = {
  env:"dev",
  platformid:1,
  platformcompanyid:1,
  commonroleid:1,
  passroleid:2,
  tanentroleid:1,
  protocalPrefix:"http://",
  appKey:"wx76a324c5d201d1a4",
  secret:"f99d413b767f09b5dff0b3610366cc46",
  salt: "%iatpD1gcxz7iF#B",
  defaultpwd:"987456",
  basepath   : path.normalize(path.join(__dirname, '../..')),
  port       : process.env.NODE_PORT || 3001,
  reqEsAddr:function(){
    if(this.env=="dev"){
      var localsettings=require("./localsettings");
      return "http://43.247.184.94:7200/";//localsettings.reqEsDevUrl;
    }else {
      return "http://43.247.184.94:7200/";
    }
  },
  apiconfig:{
    opLogUrl:function(){
      return settings.reqEsAddr()+"bigdata_zc_op_log/_doc?pretty";
    },
    opLogEsIsAdd:function(){
      return 1;
    },
  },
  homePage:function(){
    if(this.env=="dev"){
      var localsettings=require("./localsettings");
      return localsettings.reqHomePageDevUrl;
    }else {
      return "http://open.gongsibao.com/";
    }
  },
  authUrl:function(){
    if(this.env=="dev"){
      var localsettings=require("./localsettings");
      return localsettings.reqAuthUrl;
    }else {
      return "http://open.gongsibao.com/auth";
    }
  },
  docUrl:function(){
    if(this.env=="dev"){
      var localsettings=require("./localsettings");
      return localsettings.docUrl;
    }else {
      return "http://open.gongsibao.com/web/common/metaCtl/getApiDoc";
    }
  },
  redis:function(){
    if(this.env=="dev"){
      var localsettings=require("./localsettings");
      return localsettings.redis;
    }else {
      return {
        host:"xxxxx",
        port:xxxxx,
        password:"xxxxx",
        db:xx,
      };
    }
  },
  database:function(){
    if(this.env=="dev"){
      var localsettings=require("./localsettings");
      return  localsettings.database;
    }else{
      return {
       dbname : "xxxxx",
       user     : "xxxx",
       password : "xxxxx",
       config   : {
           host: 'xxxxxx',
           dialect: 'mysql',
           operatorsAliases: false,
           pool: {
             max: 5,
             min: 0,
             acquire: 90000000,
             idle: 1000000
           },
           debug:false,
           dialectOptions:{
               requestTimeout: 999999,
               // instanceName:'DEV'
           }  //设置MSSQL超时时间
       },
     };
    }
  }
};
module.exports = settings;
