module.exports = {
    current: {server: "192.168.1.184", port: "60666",redis:{server:'192.168.1.184',port:'6379',pwd:'smartCost'}},
    defaultLicenseKey:'ym.smartcost.com.cn|qm.smartcost.com.cn|um.smartcost.com.cn|civil.smartcost.com.cn|yun.smartcost.com.cn|cloud.smartcost.com.cn|qa.smartcost.com.cn|uat.smartcost.com.cn|zbqa.smartcost.com.cn|zbuat.smartcost.com.cn|jlqa.smartcost.com.cn|jluat.smartcost.com.cn|zb.smartcost.com.cn|jl.smartcost.com.cn|yhqa.smartcost.com.cn|yhqm.smartcost.com.cn|yhuat.smartcost.com.cn|yhum.smartcost.com.cn|yhyun.smartcost.com.cn|yhm.smartcost.com.cn,834986144349993#A0TLM36YuQ7cvNGdyFWbz9SYxxibj9SbvNmL4N7bjRnch56cuQWdvx6Ys86Yu46bj9Cdz36Y4JXYtNnLuVXes86Yu46bj9Cdz36Y4JXYtNnLslmdpNGLuNmLt36YuQ7cvNGdyFWbz9Sb5xibj9SbvNmL4N7bjRnch56cu4Wcs86Yu46bj9Cdz36Y4JXYtNnLtlnI0IyctRkIsICuPWOrFWOkZmeicaut1S+r3iOsWa+mIWuqoaet0e+t5aOoPeuI0ISYONkIsIyM9kTO4MDN4EjN8kDNzgjI0ICZJJCL3V6csFmZ0IiczRmI1pjIs9WQisnOiQkIsISP3E4a5AjYvgzT5Zkb0l5SwplNj5GM4QEZ6MleIhnMSZUdT5mV8JmWhV4SrR6TQtkUVFFStZVUtdHRUZ6VCZHbWpWQuNTYlpnU6F4R4oFNslmNwBTekpkZiojITJCLxcjN9ITOykzM0IicfJye#4Xfd5nIzImNnJiOiMkIsISMx8idgMlSgQWYlJHcTJiOi8kI1tlOiQmcQJCLiQDM4QDOwASNyEDM9EDMyIiOiQncDJCLi86Yu46bj9Cdz36Y4JXYtNnLthWes86Yu46bj9Cdz36Y4JXYtNnLuVXeolHLuNmLt36YuQ7cvNGdyFWbz9Sb5hWes86Yu46bj9Cdz36Y4JXYtNnL4FWdolHLuNmLt36YuQ7cvNGdyFWbz9SbxhWes86Yu46bj9Cdz36Y4JXYtNnLhFHa9xibj9SbvNmL4N7bjRnch56cuwmas86Yu46bj9Cdz36Y4JXYtNnLipHLuNmLt36YuQ7cvNGdyFWbz9CdhVHbqxibj9SbvNmL4N7bjRnch56cuEWcspGLuNmLt36YuQ7cvNGdyFWbz9CdhVnY0xibj9SbvNmL4N7bjRnch56cuEWcipHLuNmLt36YuQ7cvNGdyFWbz9CdhVULhN',
    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: "172.18.111.231",
        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"
    },
    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;
        if(me[env].dbURL){
            return me[env].dbURL.replace('yanghu','yanghuUsers');
        }
        if(me[env].options){
            return 'mongodb://'+ me[env].options.user +':'+ me[env].options.pass+'@'+ me[env].server+ ':'+ me[env].port + '/yanghuUsers?authSource=admin';
        }else {
            return  'mongodb://' + me[env].server + ':' + me[env].port + '/yanghuUsers';
        }
    },
    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){
            importURL = "127.0.0.1:2050";
        }
        return importURL
    }
}
