feat(M02-B): 实现微信登录与可撤销会话
This commit is contained in:
+10
-1
@@ -2,12 +2,21 @@ import { buildApp } from './app.js';
|
||||
import { loadConfig } from './config.js';
|
||||
import { closeMySqlPool, createMySqlPool } from './db/mysql.js';
|
||||
import { PlatformConfigRepository } from './tenancy/platform-config-repository.js';
|
||||
import { AuthRepository } from './auth/auth-repository.js';
|
||||
import { parseWechatAppSecrets, WechatHttpClient } from './auth/wechat-client.js';
|
||||
|
||||
const config = loadConfig();
|
||||
const pool = createMySqlPool(config);
|
||||
const app = await buildApp({
|
||||
config,
|
||||
platformConfigRepository: new PlatformConfigRepository(pool)
|
||||
platformConfigRepository: new PlatformConfigRepository(pool),
|
||||
auth: {
|
||||
repository: new AuthRepository(pool),
|
||||
wechat: new WechatHttpClient(parseWechatAppSecrets(config.auth.wechatAppSecretsJson)),
|
||||
jwtSecret: config.auth.jwtSecret,
|
||||
accessTokenTtlSeconds: config.auth.accessTokenTtlSeconds,
|
||||
sessionTtlSeconds: config.auth.sessionTtlSeconds
|
||||
}
|
||||
});
|
||||
app.addHook('onClose', async () => {
|
||||
await closeMySqlPool(pool);
|
||||
|
||||
Reference in New Issue
Block a user