import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
import defaultConfig from './config.default';

export default (appInfo: EggAppInfo) => {
  const config = {} as PowerPartial<EggAppConfig>;

  config.mongoose = {
    url: 'mongodb://dbop:zyzDev2022@dds-8vbc0bc9420028041.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vbc0bc9420028042.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-508590620', // 内网
    options: { useNewUrlParser: true, useUnifiedTopology: true },
  };
  config.redis = {
    url: 'r-8vb418l8kkju9sis8k.redis.zhangbei.rds.aliyuncs.com', // 内网
    pw: 'zyz_dev_2021'
  };

  // the return config will combines to EggAppConfig
  return {
    ...defaultConfig(appInfo),
    ...config
  };
};
