feat(api): add dynamic server URL configuration to OpenAPI schema

Add a new postprocessing hook 'add_api_servers' that dynamically configures
the servers array in the OpenAPI specification based on the request environment.

This hook:
- Detects the current environment (local, staging, or production) from the
  request host
- Adds the current server URL as the primary option
- Includes production (https://api.prowler.com) as a fallback option when
  generating from non-production environments
- Enables users to toggle between local and production servers in Mintlify's
  API playground via a dropdown

Server detection logic:
- localhost/127.0.0.1 → "Local Development Server"
- hosts with 'dev' or 'staging' → "Development/Staging API"
- api.prowler.com → "Prowler Cloud API"

This enables the "Try it out" feature in Mintlify documentation and allows
testing against different environments without modifying the spec.
This commit is contained in:
Andoni A.
2025-11-05 12:04:18 +01:00
parent 00441e776d
commit 6815a9dd86
4 changed files with 58 additions and 18998 deletions
+10
View File
@@ -25722,5 +25722,15 @@
"name": "Mute Rules",
"description": "Endpoints for simple mute rules management. These can be used as an alternative to the Mutelist Processor if you need to mute specific findings across your tenant with a specific reason."
}
],
"servers": [
{
"url": "http://localhost:8080",
"description": "Local Development Server"
},
{
"url": "https://api.prowler.com",
"description": "Prowler Cloud API (Production)"
}
]
}