登录优化:gate可变为短链接

This commit is contained in:
luying
2021-09-03 10:36:11 +08:00
parent e3f3b5f2a1
commit 4069220698
24 changed files with 141 additions and 14 deletions
+11 -1
View File
@@ -1,6 +1,7 @@
import 'reflect-metadata'
import * as mongoose from 'mongoose';
import { Application, IBoot } from 'egg';
import { connectRedis } from './app/pubUtils/redis';
export default class FooBoot implements IBoot {
private readonly app: Application;
@@ -13,7 +14,9 @@ export default class FooBoot implements IBoot {
// Ready to call configDidLoad,`
// Config, plugin files are referred,`
// this is the last chance to modify the config.
await this.connectDB(this.app)
await this.connectDB(this.app);
await this.connectRedis(this.app);
}
configDidLoad() {
@@ -54,6 +57,13 @@ export default class FooBoot implements IBoot {
}
}
public async connectRedis(app: Application) {
const { url, pw } = app.config.redis
if (url) {
const redisClient = connectRedis(url, pw);
app.context.redisClient = redisClient;
}
}
//#endregion
}