diff --git a/app.py b/app.py index badaa3a..4464939 100755 --- a/app.py +++ b/app.py @@ -217,12 +217,24 @@ def get_openapi(): """Serve the OpenAPI specification file""" try: # Read the openapi.json file from the filesystem - with open('openapi.json', 'r') as f: - import json + # Try multiple locations to handle Docker vs local execution + import os + import json + + # Check if we're in Docker (working directory is /app) + current_dir = os.getcwd() + if current_dir == '/app': + # In Docker, the file should be in /app + file_path = '/app/openapi.json' + else: + # Local execution + file_path = 'openapi.json' + + with open(file_path, 'r') as f: spec = json.load(f) return jsonify(spec) except Exception as e: - return jsonify({"error": "OpenAPI specification not found"}), 404 + return jsonify({"error": f"OpenAPI specification not found: {str(e)}"}), 404 if __name__ == '__main__': # Fix the port issue by using a different port