add api url
This commit is contained in:
parent
36f6657be7
commit
1bfd12ceb2
10
src/app.ts
10
src/app.ts
@ -1,5 +1,6 @@
|
||||
import Fastify from "fastify";
|
||||
import fastifySwagger from "@fastify/swagger";
|
||||
import { config } from "./config.js";
|
||||
import { client } from "./db/index.js";
|
||||
import { errorHandler } from "./plugins/error-handler.js";
|
||||
import { authenticate } from "./plugins/authenticate.js";
|
||||
@ -24,12 +25,9 @@ export function buildApp() {
|
||||
description: "Authentication and account management API",
|
||||
version: "1.0.0",
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
url: "http://localhost:3000",
|
||||
description: "Development server",
|
||||
},
|
||||
],
|
||||
servers: config.API_URL
|
||||
? [{ url: config.API_URL, description: "Production server" }]
|
||||
: [{ url: "http://localhost:3000", description: "Development server" }],
|
||||
components: {
|
||||
securitySchemes: {
|
||||
bearerAuth: {
|
||||
|
||||
@ -6,6 +6,7 @@ const envSchema = z.object({
|
||||
JWT_SECRET: z.string().min(32),
|
||||
PORT: z.coerce.number().default(3000),
|
||||
HOST: z.string().default("0.0.0.0"),
|
||||
API_URL: z.url().optional(),
|
||||
});
|
||||
|
||||
const parsed = envSchema.safeParse(process.env);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user