fix(env): 要求配置 SoH 预测服务

This commit is contained in:
2026-05-11 23:38:38 +08:00
parent a131bb845b
commit 8a3d5fd947
3 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
DATABASE_URL=mysql://user:password@localhost:3306/database DATABASE_URL=mysql://user:password@localhost:3306/database
# Optional: external AI SoH prediction service. # Required: external AI SoH prediction service.
# SOH_PREDICTION_API_BASE_URL=http://127.0.0.1:8000 SOH_PREDICTION_API_BASE_URL=http://127.0.0.1:8000
# SOH_PREDICTION_CACHE_TTL_SECONDS=86400 # SOH_PREDICTION_CACHE_TTL_SECONDS=86400
# SOH_PREDICTION_TIMEOUT_MS=10000 # SOH_PREDICTION_TIMEOUT_MS=10000
+3
View File
@@ -26,6 +26,7 @@ services:
condition: service_healthy condition: service_healthy
environment: environment:
- DATABASE_URL=mysql://battery:battery@db:3306/battery_soh - DATABASE_URL=mysql://battery:battery@db:3306/battery_soh
- SOH_PREDICTION_API_BASE_URL=http://host.docker.internal:8000
command: [ "bun", "run", "seed" ] command: [ "bun", "run", "seed" ]
app: app:
@@ -33,6 +34,8 @@ services:
depends_on: depends_on:
seed: seed:
condition: service_completed_successfully condition: service_completed_successfully
extra_hosts:
- "host.docker.internal:host-gateway"
ports: ports:
- "3000:3000" - "3000:3000"
environment: environment:
+1 -1
View File
@@ -7,7 +7,7 @@ export const env = createEnv({
LOG_DB: z.stringbool().default(false), LOG_DB: z.stringbool().default(false),
LOG_FORMAT: z.enum(['pretty', 'json']).optional(), LOG_FORMAT: z.enum(['pretty', 'json']).optional(),
LOG_LEVEL: z.enum(['trace', 'debug', 'info', 'warning', 'error', 'fatal']).default('info'), LOG_LEVEL: z.enum(['trace', 'debug', 'info', 'warning', 'error', 'fatal']).default('info'),
SOH_PREDICTION_API_BASE_URL: z.url({ protocol: /^https?$/ }).optional(), SOH_PREDICTION_API_BASE_URL: z.url({ protocol: /^https?$/ }),
SOH_PREDICTION_CACHE_TTL_SECONDS: z.coerce.number().int().positive().default(86_400), SOH_PREDICTION_CACHE_TTL_SECONDS: z.coerce.number().int().positive().default(86_400),
SOH_PREDICTION_TIMEOUT_MS: z.coerce.number().int().positive().default(10_000), SOH_PREDICTION_TIMEOUT_MS: z.coerce.number().int().positive().default(10_000),
}, },