apps/engine 独立进程(syncRound + 防重叠调度);上游 log/token;QPU 采样; server 读 engine_status;时刻出参 toUnixSec;中文日志;zod-openapi 扩展顺序修复。
28 lines
746 B
TypeScript
28 lines
746 B
TypeScript
import { createApp } from "./app.ts";
|
||
import { loadEnv } from "./env.ts";
|
||
import { createDb } from "@new-api-key-usage/db";
|
||
import { appLogger, setupLogging } from "@new-api-key-usage/core";
|
||
|
||
const env = loadEnv(process.env);
|
||
setupLogging(env.LOG_LEVEL);
|
||
|
||
const db = createDb(env.DATABASE_URL);
|
||
|
||
const app = createApp({
|
||
db,
|
||
skKeyEncryptionSecret: env.SK_KEY_ENCRYPTION_SECRET,
|
||
newapiBase: env.NEWAPI_BASE,
|
||
cookieSecure: env.COOKIE_SECURE,
|
||
adminInitUsername: env.ADMIN_INIT_USERNAME,
|
||
adminInitPassword: env.ADMIN_INIT_PASSWORD,
|
||
});
|
||
|
||
appLogger("server").info(
|
||
`服务已启动,端口 ${env.PORT}(cookie_secure=${env.COOKIE_SECURE},日志级别=${env.LOG_LEVEL})`,
|
||
);
|
||
|
||
export default {
|
||
port: env.PORT,
|
||
fetch: app.fetch,
|
||
};
|