fix: Make Swagger server URLs fully configurable
- Add configurable server URL from API_BASE_URL env var - Make production server optional via PRODUCTION_API_URL env var - Remove hardcoded https://api.goagel.gov.in - Document PRODUCTION_API_URL in .env.example
This commit is contained in:
@@ -87,7 +87,7 @@ async function bootstrap(): Promise<void> {
|
||||
|
||||
// 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<void> {
|
||||
'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')
|
||||
|
||||
Reference in New Issue
Block a user