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:zyzIsbn2021@dds-8vb74337eab84d641.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vb74337eab84d642.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-504694158', // 内网
    options: { useNewUrlParser: true, useUnifiedTopology: true },
  };
  config.redis = {
    url: 'r-8vbekkbb3z8ru2ckuj.redis.zhangbei.rds.aliyuncs.com', // 内网
    pw: 'zyz_isbn_2021'
  };

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