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.
This commit is contained in:
parent
bd63dc3c91
commit
7727467e29
@ -193,17 +193,18 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Run in CI mode
|
# Run in CI mode
|
||||||
if is_ci: # CI mode
|
# Generate or use SSL Key and Certificate
|
||||||
print("CI mode detected: Starting server in a subprocess...")
|
if environment in ["test", "dev", "ci"]:
|
||||||
# Ensure SSL directory exists
|
ssl_dir = Path(
|
||||||
ssl_dir = Path("ssl")
|
cert_path
|
||||||
|
).parent # Ensure we work with the parent directory of the cert path
|
||||||
ssl_dir.mkdir(
|
ssl_dir.mkdir(
|
||||||
parents=True, exist_ok=True
|
parents=True, exist_ok=True
|
||||||
) # Create ssl directory if it doesn't exist
|
) # Create the directory structure if it doesn't exist
|
||||||
|
|
||||||
# Ensure SSL certificate and key exist
|
# Generate self-signed certs if missing
|
||||||
if not Path(cert_path).exists() or not Path(key_path).exists():
|
if not Path(cert_path).exists() or not Path(key_path).exists():
|
||||||
print("Generating SSL certificates for CI mode...")
|
print(f"[INFO] Generating self-signed SSL certificates at {ssl_dir}")
|
||||||
ssl_heidi.generate_self_signed_cert(cert_path, key_path)
|
ssl_heidi.generate_self_signed_cert(cert_path, key_path)
|
||||||
|
|
||||||
server_process = Process(target=run_server)
|
server_process = Process(target=run_server)
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"start-dev": "vite --mode dev",
|
"start-dev": "vite --mode dev",
|
||||||
"start-test": "vite --mode test"
|
"start-test": "vite --mode test",
|
||||||
|
"start-prod": "vite --mode prod"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user