Commit 7a451864 authored by Lê Bảo Hồng Đức's avatar Lê Bảo Hồng Đức

fix gen api

parent 3e1d1502
This diff is collapsed.
...@@ -28,8 +28,15 @@ const backendHost = process.env.NEXT_PUBLIC_BACKEND_HOST; ...@@ -28,8 +28,15 @@ const backendHost = process.env.NEXT_PUBLIC_BACKEND_HOST;
const siteURL = process.env.NEXT_PUBLIC_FRONTEND_HOST; const siteURL = process.env.NEXT_PUBLIC_FRONTEND_HOST;
const swaggerCandidates = [ const swaggerCandidates = [
// 1) Explicit override (highest priority)
process.env.ORVAL_SWAGGER_URL, process.env.ORVAL_SWAGGER_URL,
// 2) Sibling backend repo (local dev with both repos checked out)
path.resolve(process.cwd(), "..", "vietprodev-cms-backend", "storage", "swagger", "swagger-output.json"), path.resolve(process.cwd(), "..", "vietprodev-cms-backend", "storage", "swagger", "swagger-output.json"),
// 3) Committed spec in repo — deterministic source for CI builds.
// Must be tried BEFORE HTTP URLs: production backend doesn't serve swagger
// and ${backendHost}/swagger/swagger-output.json may return a stale/wrong spec.
path.resolve(process.cwd(), "openapi", "swagger-output.json"),
// 4) HTTP fallbacks (last resort)
`${backendHost}/swagger-output.json`, `${backendHost}/swagger-output.json`,
`${backendHost}/swagger/swagger-output.json`, `${backendHost}/swagger/swagger-output.json`,
`${backendHost}/swagger.json`, `${backendHost}/swagger.json`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment