feat(M02-A): 建立多小程序租户配置模型
This commit is contained in:
+10
-1
@@ -1,8 +1,17 @@
|
||||
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';
|
||||
|
||||
const config = loadConfig();
|
||||
const app = await buildApp({ config });
|
||||
const pool = createMySqlPool(config);
|
||||
const app = await buildApp({
|
||||
config,
|
||||
platformConfigRepository: new PlatformConfigRepository(pool)
|
||||
});
|
||||
app.addHook('onClose', async () => {
|
||||
await closeMySqlPool(pool);
|
||||
});
|
||||
|
||||
try {
|
||||
await app.listen({ host: config.host, port: config.port });
|
||||
|
||||
Reference in New Issue
Block a user