From 60350794da0968f0ec88b59b6e978b7e5c6cb73d Mon Sep 17 00:00:00 2001 From: "Andoni A." <14891798+andoniaf@users.noreply.github.com> Date: Wed, 12 Nov 2025 09:30:26 +0100 Subject: [PATCH] feat(api): show only production URL in API reference playground --- api/src/backend/api/schema_hooks.py | 40 +++++------------------------ api/src/backend/api/specs/v1.yaml | 4 +-- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/api/src/backend/api/schema_hooks.py b/api/src/backend/api/schema_hooks.py index f6572518ff..f2cc5a75e9 100644 --- a/api/src/backend/api/schema_hooks.py +++ b/api/src/backend/api/schema_hooks.py @@ -156,45 +156,19 @@ def add_api_servers(result, generator, request, public): # noqa: F841 """ Add servers configuration to OpenAPI spec for Mintlify API playground. This enables the "Try it out" feature in the documentation. - Dynamically determines the server URL based on the request. + Only adds the production URL to ensure consistent documentation. """ if not isinstance(result, dict): return result # Add servers array if not already present if "servers" not in result: - servers = [] - - # Try to get the current server URL from the request - if request: - scheme = request.scheme # http or https - host = request.get_host() # e.g., localhost:8080 or api.prowler.com - - # Determine description based on host - if "localhost" in host or "127.0.0.1" in host: - description = "Local Development Server" - elif "dev" in host or "staging" in host: - description = "Development/Staging API" - else: - description = "Prowler Cloud API" - - servers.append( - { - "url": f"{scheme}://{host}", - "description": description, - } - ) - - # Always add production as fallback/alternative - if not servers or (request and "prowler.com" not in request.get_host()): - servers.append( - { - "url": "https://api.prowler.com", - "description": "Prowler Cloud API (Production)", - } - ) - - result["servers"] = servers + result["servers"] = [ + { + "url": "https://api.prowler.com", + "description": "Prowler Cloud API", + } + ] return result diff --git a/api/src/backend/api/specs/v1.yaml b/api/src/backend/api/specs/v1.yaml index f7459468ca..ad0d5b6571 100644 --- a/api/src/backend/api/specs/v1.yaml +++ b/api/src/backend/api/specs/v1.yaml @@ -19095,7 +19095,5 @@ tags: 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) + description: Prowler Cloud API