'use strict';

module.exports = appInfo => {
  const config = exports = {};
  config.debug = true;

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1554705194320_9697';
  config.projectRootPath = '/51business/api';


  // 是否启用csrf安全
  config.security = {
    csrf: {
      enable: false,
    },
    domainWhiteList: [],
  };

  config.middleware = [ 'errorHandler', 'deviceLogin', 'deviceInit', 'responseSet' ];
  // config.middleware = [];

  exports.multipart = {
    // 不用steam用file
    mode: 'file',
    // will append to whilelist
    fileExtensions: [
      // images
      '.jpg',
      '.jpeg', // image/jpeg
      '.png', // image/png, image/x-png
      '.gif', // image/gif
      '.bmp', // image/bmp
      '.wbmp', // image/vnd.wap.wbmp
      '.webp',
      '.tif',
      '.psd',
      '.xlsx',
      '.xls',
    ],
  };

  config.sequelize = {

    datasources: [
      {
        // 东八时区
        timezone: '+08:00',
        delegate: 'blockModel',
        baseDir: 'model/block',
        // other sequelize configurations
        dialect: 'mysql',
        host: 'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com',
        database: 'poseidon_uat',
        username: 'kf_liuhaihua',
        password: '24u1GaFh96khR31T7zs2y',
        port: 3306,
      },
      {
        // 东八时区
        timezone: '+08:00',
        delegate: 'realestateModel',
        baseDir: 'model/realestate',
        // other sequelize configurations
        dialect: 'mysql',
        host: 'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com',
        database: 'realestate_dev',
        username: 'realestate',
        password: 'ppD1sDSutHG83T2s1Ue3k',
        port: 3306,
      },
      {
        // 东八时区
        timezone: '+08:00',
        delegate: 'huodongModel',
        baseDir: 'model/huodong',
        // other sequelize configurations
        dialect: 'mysql',
        host: 'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com',
        database: 'devhuodong',
        username: 'devhuodong',
        password: 'jianbing2014GG',
        port: 3306,
      },
      {
        // 东八时区
        timezone: '+08:00',
        delegate: 'prometheusModel',
        baseDir: 'model/prometheus',
        // other sequelize configurations
        dialect: 'mysql',
        host: 'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com',
        database: 'prometheus_dev',
        username: 'prometheus',
        password: 'q9t8Ay4qIUW4sw3s25K28',
        port: 3306,
      },
      {
        // 东八时区
        timezone: '+08:00',
        delegate: 'classModel',
        baseDir: 'model/class',
        // other sequelize configurations
        dialect: 'mysql',
        host: 'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com',
        database: 'class_uat',
        username: 'class_testing',
        password: 'WV862L32451I6KD58tU9K',
        port: 3306,
      },
    ],

  };

  config.redis = {
    client: {
      port: 6379,
      host: '116.62.55.137',
      password: 'DEV8redis',
      db: 0,
    },
  };

  exports.oss = {// sdfsdfsd
    client: {
      accessKeyId: 'LTAIxEMB8ucstyi8',
      accessKeySecret: 'sCVJSCPyfaSIlS5R8fH4Xl77yHKR3z',
      bucket: '51shequ',
      endpoint: 'oss-cn-hangzhou.aliyuncs.com',
      timeout: '60s',
    },
  };

  exports.session = {
    key: 'SESSION_ID',
    maxAge: 24 * 3600 * 1000, // 1 天
    httpOnly: true,
    encrypt: true,
  };

  config.PHP_URL = 'https://kaifa.jianbing.com';
  config.NODE_URL = 'https://uat-nginx.jianbing.com/user_api/v1';
  config.NODE_BASE_URL = 'https://uat-nginx.jianbing.com';
  config.HOUSE_SERVICE_API = 'https://uat-nginx.jianbing.com/house-service';

  config.CDN_BASE_URL = 'https://r.51gjj.com/image/';

  config.USER_CENTER_API_URI = 'https://uat-nginx.jianbing.com/usercenter-service';

  config.BLACKLIST_APPLY_APPKEY = 'F4E0CA710F484CFFB1756741696E29A3';
  config.BLACKLIST_APPLY_APPSECRET = '233B8E10E31B4C899EE6FEB3AEC22F140B6528BF';
  config.BLACKLIST_APPLY_URL = 'http://47.96.253.64:8049/mycredit/blackList';

  config.OUT_P_NODE_URL = 'https://dev-nginx.jianbing.com';

  // 数盒魔方
  config.SHUHEMOFANG_APP_KEY = 'BdNFbog6';
  config.SHUHEMOFANG_APP_SECRET = 'a695e9b3c0f1e3f15fb0b958fd3a4b67';
  config.SHUHEMOFANG_URL = 'https://api.soohaid.com:8211/api/mobile/factor3s';

  // 微信支付相关内容
  config.MCH_APPID = 'wx0369cb31f505d8ce';// 商户关联的APPID
  config.MCH_ID = '1516742591';// 商户id
  config.MCH_KEY = 'xiXigu4008635151jianbing6floor12';// 商户秘钥

  // 腾讯位置服务
  config.TX_LBS_KEY = 'TNHBZ-A7C36-5DISQ-EM2JH-332V5-PGFW5';
  config.TX_LBS_DISTANCE_URL = 'https://apis.map.qq.com/ws/distance/v1/'; // 距离计算（一对多）
  config.TX_LBS_ADDRESS_URL = 'https://apis.map.qq.com/ws/geocoder/v1/'; // 地址解析；逆地址解析
  config.TX_LBS_URL = 'https://apis.map.qq.com/ws'; // 地址解析；逆地址解析


  // 我的信用-通化检测
  config.YYS_APP_KEY = 'A86BB96F55B64DCE87A46E919A347993';
  config.YYS_APPLY_APPSECRET = 'a695e9b3c0f1e3f15fb0b958fd3a4b67';

  // 运营商报告
  config.YYS_REPORT_KEY = 'F4E0CA710F484CFFB1756741696E29A3';
  config.YYS_REPORT_APPSECRET = '233B8E10E31B4C899EE6FEB3AEC22F140B6528BF';
  config.YYS_REPORT_URL = 'http://47.96.253.64:8049/mycredit/thxdReport';

  // 趣选课微信配置
  config.COURSE_WX_APPID = 'wx07a5f0ed5bdf4751';
  config.COURSE_WX_SECRET = 'a1b2d32b018988176181497bd74a0b7d';

  return config;
};
