diff --git a/.env.example b/.env.example index 71f3a4f..932bcec 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ DATABASE_URL=mysql://user:password@localhost:3306/database -# Optional: external AI SoH prediction service. -# SOH_PREDICTION_API_BASE_URL=http://127.0.0.1:8000 +# Required: external AI SoH prediction service. +SOH_PREDICTION_API_BASE_URL=http://127.0.0.1:8000 # SOH_PREDICTION_CACHE_TTL_SECONDS=86400 # SOH_PREDICTION_TIMEOUT_MS=10000 diff --git a/compose.yaml b/compose.yaml index 1f2a40b..fab7fc8 100644 --- a/compose.yaml +++ b/compose.yaml @@ -26,6 +26,7 @@ services: condition: service_healthy environment: - DATABASE_URL=mysql://battery:battery@db:3306/battery_soh + - SOH_PREDICTION_API_BASE_URL=http://host.docker.internal:8000 command: [ "bun", "run", "seed" ] app: @@ -33,6 +34,8 @@ services: depends_on: seed: condition: service_completed_successfully + extra_hosts: + - "host.docker.internal:host-gateway" ports: - "3000:3000" environment: diff --git a/src/env.ts b/src/env.ts index ff614d1..4983a6c 100644 --- a/src/env.ts +++ b/src/env.ts @@ -7,7 +7,7 @@ export const env = createEnv({ LOG_DB: z.stringbool().default(false), LOG_FORMAT: z.enum(['pretty', 'json']).optional(), 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_TIMEOUT_MS: z.coerce.number().int().positive().default(10_000), },