feat(server): 单域托管 client/dist 与 SPA 回退(E12)
- 新增 SERVE_CLIENT_DIST/CLIENT_DIST_DIR 配置 - 开启后注册 @fastify/static 并对非 /api GET(html) 回退 index.html - docker-compose.yml 与 README 补充用法
这个提交包含在:
@@ -14,6 +14,7 @@ function getConfig() {
|
||||
const nodeEnv = process.env.NODE_ENV ?? "development";
|
||||
const serverRoot = path.resolve(__dirname, "..");
|
||||
const storageDir = process.env.STORAGE_DIR ?? "generated/storage";
|
||||
const clientDistDir = process.env.CLIENT_DIST_DIR ?? "../client/dist";
|
||||
|
||||
return {
|
||||
nodeEnv,
|
||||
@@ -40,6 +41,8 @@ function getConfig() {
|
||||
|
||||
appTimezone: process.env.APP_TIMEZONE ?? "Asia/Shanghai",
|
||||
storageDir: path.resolve(serverRoot, storageDir),
|
||||
serveClientDist: process.env.SERVE_CLIENT_DIST === "true",
|
||||
clientDistDir: path.resolve(serverRoot, clientDistDir),
|
||||
signedUrlTtlSeconds: Number(process.env.SIGNED_URL_TTL_SECONDS ?? 600),
|
||||
maxUploadSizeBytes: Number(process.env.MAX_UPLOAD_SIZE_BYTES ?? 10 * 1024 * 1024),
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户