module.exports = {
  current: {
    server: "192.168.1.184",
    port: "60666",
    redis: {
      server: '192.168.1.184',
      port: '6379',
      pwd: 'smartCost'
    }
  },
  defaultLicenseKey: "admin.jl2.smartcost.com.cn|admin.jlqa2.smartcost.com.cn|admin.jluat2.smartcost.com.cn|cgyh.smartcost.com.cn|civil.smartcost.com.cn|cloud.smartcost.com.cn|glm.smartcost.com.cn|gluat.smartcost.com.cn|glum.smartcost.com.cn|glyun.smartcost.com.cn|gsm.smartcost.com.cn|gsqa.smartcost.com.cn|gsqm.smartcost.com.cn|gsuat.smartcost.com.cn|gsum.smartcost.com.cn|gsyun.smartcost.com.cn|jl.smartcost.com.cn|jl2.smartcost.com.cn|jl2admin.smartcost.com.cn|jladmin.smartcost.com.cnjlqaadmin.smartcost.com.cn|jlhw.smartcost.com.cn|jlhwuat.smartcost.com.cn|jlqa.smartcost.com.cn|jlqa2.smartcost.com.cn|jluat.smartcost.com.cn|jluat2.smartcost.com.cn|jluatadmin.smartcost.com.cn|pm.smartcost.com.cn|pmqa.smartcost.com.cn|pmuat.smartcost.com.cn|qa.smartcost.com.cn|qa.std.smartcost.com.cn|qm.smartcost.com.cn|std.smartcost.com.cn|uat.smartcost.com.cn|um.smartcost.com.cn|yhm.smartcost.com.cn|yhqa.smartcost.com.cn|yhqm.smartcost.com.cn|yhuat.smartcost.com.cn|yhum.smartcost.com.cn|yhyun.smartcost.com.cn|ym.smartcost.com.cn|yun.smartcost.com.cn|zb.smartcost.com.cn|zbqa.smartcost.com.cn|zbuat.smartcost.com.cn,681116852352674#A0HZgFWcspmbj9SbvNmL4N7bjRnch56cu8WatRWYspGLuNmLt36YuQ7cvNGdyFWbz9ibp5GZhJDbqxibj9SbvNmL4N7bjRnch56cuIDbqxibj9SbvNmL4N7bjRnch56cuwmas86Yu46bj9Cdz36Y4JXYtNnLuVXezdGLuNmLt36YuQ7cvNGdyFWbz9Sb5N7Zs86Yu46bj9Cdz36Y4JXYtNnL4FWdzdGLuNmLt36YuQ7cvN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bjRnch56cu4Ga9xibj9SbvNmL4N7bjRnch56cu4Wds86Yu46bj9Cdz36Y4JXYtNnL4FWds86Yu46bj9Cdz36Y4JXYtNnLkR7cs86Yu46bj9Cdz36Y4JXYtNnLtFHLuNmLt36YuQ7cvNGdyFWbz9CZ4NnLhFHLuNmLt36YuQ7cvNGdyFWbz9SYxxibj9SbvNmL4N7bjRnch56cuQXY55Gcs86Yu46bj9Cdz36Y4JXYtNnLhFXbwxibj9SbvNmL4N7bjRnch56cu4Gcs86Yu46bj9Cdz36Y4JXYtNnLulWbkFGdhVHbqxibj9SbvNmL4N7bjRnch56cuIDdhVHbqxibj9SbvNmL4N7bjRnch56cuQXY5xmas86Yu46bj9Cdz36Y4JXYtNnLyEWcspGLuNmLt36YuQ7cvNGdyFWbz9SYxxmas86Yu46bj9Cdz36Y4JXYtNnL4FWd7hGbqxibj9SbvNmL4N7bjRnch56cucHaspGLuNmLt36YuQ7cvNGdyFWbz9PbI1",
  local: {
    server: "localhost",
    port: "27017"
  },
  qa: {
    server: "192.168.1.90",
    port: "60666",
    options: {
      user: 'smartcost',
      pass: 'smartcost3850888',
      auth: {
        "authdb": "admin"
      },
      connectTimeoutMS: 50000,
      useMongoClient: true
    },
    importURL: "192.168.1.90:2050"
  },
  qa_outer: {
    server: "smartcost.in.8866.org",
    port: "26904",
    options: {
      user: 'smartcost',
      pass: 'smartcost3850888',
      auth: {
        "authdb": "admin"
      },
      connectTimeoutMS: 100000,
      useMongoClient: true
    },
    importURL: "192.168.1.184:6050"
  },
  test_auth: {
    server: "120.78.150.216",
    port: "27017",
    options: {
      user: 'smartcost',
      pass: 'smartcost3850888',
      auth: {
        "authdb": "yanghu"
      },
      connectTimeoutMS: 20000,
      useMongoClient: true
    }
  },
  pp: {
    server: "112.74.42.187",
    port: "27017",
    options: {
      user: 'smartcost',
      pass: 'SmartCost3850888',
      auth: {
        "authdb": "admin"
      },
      connectTimeoutMS: 50000,
      useMongoClient: true
    },
    importURL: "172.18.111.231:2050"
  },
  pp_out: {
    server: "112.74.42.187",
    port: "27017",
    options: {
      user: 'smartcost',
      pass: 'SmartCost3850888',
      auth: {
        "authdb": "admin"
      },
      connectTimeoutMS: 50000,
      useMongoClient: true
    },
    importURL: "112.74.42.187:2050"
  },
  prod_s: {
    server: "112.74.42.187",
    port: "28066",
    options: {
      user: 'smartcost',
      pass: 'SmartCost3850888',
      auth: {
        "authdb": "admin"
      },
      connectTimeoutMS: 50000,
      useMongoClient: true
    }
  },
  prod: {
    dbURL: "mongodb://smartcost:SmartCost3850888@dds-wz9da4d5ca0fdd341.mongodb.rds.aliyuncs.com:3717,dds-wz9da4d5ca0fdd342.mongodb.rds.aliyuncs.com:3717/yanghu?authSource=admin;replicaSet=mgset-7518601", //&readPreference=secondaryPreferred
    // LicenseKey:"civil.smartcost.com.cn|yun.smartcost.com.cn|cloud.smartcost.com.cn,834986144349993#A0BfNtmD0jnLiOiEmTDJCLiMTO9kDNzQDNxYDO9QzM8IiOiQWSiwSflNHbhZmOiI7ckJye0ICbuFkI1pjIEJCLi4TP7BzU6d7Z9RFbrRzNNNHNFJzStVFU7llaFdkeNdDV59UYkBjWxRjUOBlW7siYu5UeVp4ZyFUd4hDZ996S5JDNJV4cXF6dvJlNTFVNuZmdPdFSj3iV8tkI0IyUiwyN7AzNxYzN7MTM0IicfJye#4Xfd5nIzImNnJiOiMkIsISMx8idgMlSgQWYlJHcTJiOi8kI1tlOiQmcQJCLiADN5QTMwACMzcDM8EDMyIiOiQncDJCLi86Yu46bj9Cdz36Y4JXYtNnLkV7bsNGLuNmLt36YuQ7cvNGdyFWbz9ib5lHLuNmLt36YuQ7cvNGdyFWbz9CbpZXajJiOiMXbEJCLig1jlzahlDZmpnInmb1uk/avoDrlmvJilrKqRXMu"
    importURL: "172.18.111.232:2050"
  },
  qa_sc: {
    title: "纵横公路云造价",//流量统计靠这个判断
    startPort: 3060,
    dbURL:"mongodb://smartcost:smartcost3850888@192.168.1.90:60666,192.168.1.90:60667/smartcost?authSource=admin;replicaSet=sc",
    // server: "192.168.1.90",
    // port: "60666",
    // dbname: 'smartcost',
    // options: {
    //   user: 'smartcost',
    //   pass: 'smartcost3850888',
    //   auth: {
    //     "authdb": "admin"
    //   },
    //   connectTimeoutMS: 60000,
    //   useMongoClient: true
    // },
    importURL: "192.168.1.90:3050",
    importPort: 3050,
    socketPort: 2200
  },
  pp_sc: {
    title: "纵横公路云造价",
    startPort: 3060,
    server: "112.74.42.187",
    port: "27017",
    dbname: 'smartcost',
    options: {
      user: 'smartcost',
      pass: 'SmartCost3850888',
      auth: {
        "authdb": "admin"
      },
      connectTimeoutMS: 60000,
      useMongoClient: true
    },
    importURL: "172.18.111.231:3050",
    importPort: 3050,
    socketPort: 2200
  },
  prod_sc: {
    title: "纵横公路云造价",
    startPort: 3060,
    dbURL: "mongodb://smartcost:SmartCost3850888@dds-wz9da4d5ca0fdd341.mongodb.rds.aliyuncs.com:3717,dds-wz9da4d5ca0fdd342.mongodb.rds.aliyuncs.com:3717/smartcost?authSource=admin;replicaSet=mgset-7518601", //&readPreference=secondaryPreferred
    // LicenseKey:"civil.smartcost.com.cn|yun.smartcost.com.cn|cloud.smartcost.com.cn,834986144349993#A0BfNtmD0jnLiOiEmTDJCLiMTO9kDNzQDNxYDO9QzM8IiOiQWSiwSflNHbhZmOiI7ckJye0ICbuFkI1pjIEJCLi4TP7BzU6d7Z9RFbrRzNNNHNFJzStVFU7llaFdkeNdDV59UYkBjWxRjUOBlW7siYu5UeVp4ZyFUd4hDZ996S5JDNJV4cXF6dvJlNTFVNuZmdPdFSj3iV8tkI0IyUiwyN7AzNxYzN7MTM0IicfJye#4Xfd5nIzImNnJiOiMkIsISMx8idgMlSgQWYlJHcTJiOi8kI1tlOiQmcQJCLiADN5QTMwACMzcDM8EDMyIiOiQncDJCLi86Yu46bj9Cdz36Y4JXYtNnLkV7bsNGLuNmLt36YuQ7cvNGdyFWbz9ib5lHLuNmLt36YuQ7cvNGdyFWbz9CbpZXajJiOiMXbEJCLig1jlzahlDZmpnInmb1uk/avoDrlmvJilrKqRXMu"
    importURL: "172.18.111.232:3050",
    importPort: 3050,
    socketPort: 2200
  },
  sc_prod: {
    title: "纵横公路云造价",
    server: "112.74.42.187",
    startPort: 3060,
    dbname: 'smartcost',
    port: "28066",
    importPort: 3050,
    socketPort: 2200,
      options:{
          user:'smartcost',
          pass:'SmartCost3850888',
          auth: {
              "authdb": "admin"
          },
          connectTimeoutMS: 50000,
          useMongoClient: true
      }
  },
  redis_local: {
    server: '127.0.0.1',
    port: '6379',
    pwd: 'smartCost'
  },
  redis_qa: {
    server: '192.168.1.184',
    port: '6379',
    pwd: 'smartCost'
  },

  setupDb: function (env = "local") {
    let me = this;
    me.current.server = me[env].server;
    me.current.port = me[env].port;
    me.current.redis = me["redis_" + env];
  },
  getSessionURL: function (env = "local") {
    let me = this;
    let dbname = "yanghu";
    if (me[env].dbname) dbname = me[env].dbname;
    if (me[env].dbURL) {
      return me[env].dbURL.replace(dbname, dbname + 'Users');
    }
    if (me[env].options) {
      return 'mongodb://' + me[env].options.user + ':' + me[env].options.pass + '@' + me[env].server + ':' + me[env].port + '/' + dbname + 'Users?authSource=admin';
    } else {
      return 'mongodb://' + me[env].server + ':' + me[env].port + '/' + dbname + 'Users';
    }
  },
  getLicenseKey: function (env = "local") {
    let me = this;
    if (me[env].LicenseKey) {
      return me[env].LicenseKey;
    } else {
      return me.defaultLicenseKey;
    }
  },
  getImportURL: function (env = "local", origin) {
    let me = this;
    let importURL = me[env].importURL;
    if (origin.indexOf("localhost") != -1 || origin.indexOf("127.0.0.1") != -1) {
      let importPort = me[env].importPort ? me[env].importPort : 2050;
      importURL = "127.0.0.1:" + importPort;
    }
    return importURL
  }
}