Refactor OpenAPI client script and backend server logic.
Simplify and streamline OpenAPI client generation and backend startup logic. Improved error handling, environment configuration, and self-signed SSL certificate management. Added support for generating OpenAPI schema via command-line argument.
This commit is contained in:
parent
33e3a2d4df
commit
555b756cac
@ -167,13 +167,18 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Run in CI mode
|
# Run in CI mode
|
||||||
if is_ci:
|
if is_ci: # CI mode
|
||||||
print("CI mode detected: Starting server in a subprocess...")
|
print("CI mode detected: Starting server in a subprocess...")
|
||||||
|
# Ensure SSL certificate and key exist
|
||||||
|
if not Path(cert_path).exists() or not Path(key_path).exists():
|
||||||
|
print("Generating SSL certificates for CI mode...")
|
||||||
|
ssl_heidi.generate_self_signed_cert(cert_path, key_path)
|
||||||
|
|
||||||
server_process = Process(target=run_server)
|
server_process = Process(target=run_server)
|
||||||
server_process.start()
|
server_process.start()
|
||||||
sleep(5)
|
sleep(5) # Wait 5 seconds to ensure the server starts without errors
|
||||||
server_process.terminate()
|
server_process.terminate() # Terminate the server (test purposes)
|
||||||
server_process.join()
|
server_process.join() # Ensure proper cleanup
|
||||||
print("CI: Server started and terminated successfully for test validation.")
|
print("CI: Server started and terminated successfully for test validation.")
|
||||||
else:
|
else:
|
||||||
run_server()
|
run_server()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user