diff --git a/.env.example b/.env.example index ef92d0c..7b9e1c0 100644 --- a/.env.example +++ b/.env.example @@ -64,6 +64,11 @@ PLATFORM_WALLET_PRIVATE_KEY= # NODE_ENV=production # FORCE_RESEED=false +# Production API URL for Swagger documentation +# Only set this when you have a production domain configured +# Example: https://api.goagel.gov.in +# PRODUCTION_API_URL= + # External ports (if defaults conflict) # API_PORT=3001 # FRONTEND_PORT=4200 diff --git a/backend/src/main.ts b/backend/src/main.ts index 2d1c94c..6070011 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -87,7 +87,7 @@ async function bootstrap(): Promise { // Swagger documentation if (swaggerEnabled) { - const swaggerConfig = new DocumentBuilder() + const swaggerBuilder = new DocumentBuilder() .setTitle('Goa GEL API') .setDescription('Blockchain Document Verification Platform for Government of Goa') .setVersion('1.0.0') @@ -110,7 +110,15 @@ async function bootstrap(): Promise { 'ApiKeyAuth', ) .addServer(`http://localhost:${port}`, 'Local Development') - .addServer('https://api.goagel.gov.in', 'Production') + .addServer(process.env.API_BASE_URL?.replace('/api/v1', '') || `http://localhost:${port}`, 'Configured Server'); + + // Add production server only if configured + const productionApiUrl = process.env.PRODUCTION_API_URL; + if (productionApiUrl) { + swaggerBuilder.addServer(productionApiUrl, 'Production'); + } + + const swaggerConfig = swaggerBuilder .addTag('Auth', 'Authentication and authorization') .addTag('Applicants', 'Applicant management') .addTag('Requests', 'License request operations')