Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit c77e5797 authored by GotthardG's avatar GotthardG
Browse files

Refactor OpenAPI fetcher for improved clarity and robustness

Reorganized and enhanced the OpenAPI fetch logic for better maintainability and error handling. Key updates include improved environment variable validation, more detailed error messages, streamlined configuration loading, and additional safety checks for file paths and directories. Added proper logging and ensured the process flow is easy to trace.
parent f80e111f
No related branches found
No related tags found
No related merge requests found
Pipeline #44780 failed
......@@ -168,9 +168,13 @@ if __name__ == "__main__":
print(f"[INFO] Starting server in {environment} environment...")
print(f"[INFO] SSL Certificate Path: {cert_path}")
print(f"[INFO] SSL Key Path: {key_path}")
port = int(
config.get("PORT", os.getenv("PORT", 8000))
) # Fetch port from config or environment
port = config.get("PORT", os.getenv("PORT"))
if not port:
print(
"[ERROR] No port defined in config or environment variables. Aborting!"
)
sys.exit(1) # Exit if no port is defined
port = int(port)
print(f"[INFO] Running on port {port}")
uvicorn.run(
app,
......
......@@ -4,6 +4,7 @@
"OPENAPI_URL": "https://mx-aare-test.psi.ch:1492/openapi.json",
"SCHEMA_PATH": "./src/openapi.json",
"OUTPUT_DIRECTORY": "./openapi",
"PORT": 1492,
"SSL_KEY_PATH": "/home/jungfrau/heidi-v2/backend/ssl/mx-aare-test.psi.ch.key",
"SSL_CERT_PATH": "/home/jungfrau/heidi-v2/backend/ssl/mx-aare-test.psi.ch.pem"
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment