fix: production crash due to undefined import.meta.env by adding env utility and updating build script

This commit is contained in:
bipproduction
2026-02-07 17:03:42 +08:00
parent 0dd2aa17d6
commit 60457b1f2f
6 changed files with 39 additions and 17 deletions

View File

@@ -15,10 +15,8 @@ const api = new Elysia({
prefix: "/api",
})
.all("/auth/*", ({ request }) => auth.handler(request))
.use(cors());
if (!isProduction) {
api.use(
.use(cors())
.use(
swagger({
path: "/docs",
documentation: {
@@ -28,10 +26,7 @@ if (!isProduction) {
},
},
}),
);
}
api
)
.get("/session", async ({ request }) => {
const data = await auth.api.getSession({ headers: request.headers });
return { data };
@@ -191,4 +186,4 @@ console.log(
`🚀 Server running at http://localhost:3000 in ${isProduction ? "production" : "development"} mode`,
);
export type ApiApp = typeof app;
export type ApiApp = typeof app;