import { MidwayConfig } from '@midwayjs/core';
/**数据库ip */
const ip = '10.120.114.5';
/**数据库名 */
const dbName = 'cxyy';
/**日志数据库名 */
const logsDB = 'cxyy_logs';
/**数据库用户名 */
const dbUsername = 'system';
/**数据库密码 */
const dbPwd = '1234qwer!@#$';
/**redis ip */
const redisHost = '10.120.114.6';
/**redis 密码 */
const redisPwd = '1234qwer!@#$';
/**redis 使用第几个数据库 */
const redisDB = 0;
/**redis 记录登录的key */
const loginSign = 'cxyy';
export default {
  // use for cookie sign key, should change to your own and keep security
  keys: '1697684406848_4978',
  loginSign,
  // 请求记录在redis留存时间,超过时间.数据变化将不会记录.以秒为单位--5分钟
  requestTimeLimit: 300,
  jwt: {
    secret: 'Ziyouyanfa!@#',
    expiresIn: 3600, // 3600
  },
  koa: {
    port: 9700,
    globalPrefix: '/cxyy/api',
    queryParseMode: 'extended',
  },
  swagger: {
    swaggerPath: '/doc/api',
  },
  elasticsearch: {
    node: 'http://192.168.1.197:9200',
    auth: {
      username: 'elastic',
      password: 'NAjqFz_7tS2DkdpU7p*x',
    },
  },
  typeorm: {
    dataSource: {
      default: {
        database: dbName,
        username: dbUsername,
        password: dbPwd,
        host: ip,
        port: 54321,
        entities: ['./entity'],
        type: 'postgres',
        synchronize: false, // 如果第一次使用，不存在表，有同步的需求可以写 true，注意会丢数据
        logging: false,
      },
      logs: {
        database: logsDB,
        username: dbUsername,
        password: dbPwd,
        host: ip,
        port: 54321,
        entities: ['./entityLogs'],
        type: 'postgres',
        synchronize: false, // 如果第一次使用，不存在表，有同步的需求可以写 true，注意会丢数据
        logging: false,
      },
    },
  },
  redis: {
    client: {
      port: 6379, // Redis port
      host: redisHost, // Redis host
      password: redisPwd,
      db: redisDB,
    },
  },
  upload: {
    whitelist: null,
  },
} as MidwayConfig;
