fixing bugs with ci pipeline

This commit is contained in:
GotthardG
2024-12-16 14:23:10 +01:00
parent d6ac89b5d8
commit 1ecbe97955
2 changed files with 25 additions and 15 deletions

View File

@ -93,18 +93,28 @@ if __name__ == "__main__":
# Get environment from an environment variable
environment = os.getenv("ENVIRONMENT", "dev")
is_ci = os.getenv("CI", "false").lower() == "true" # Check if running in CI
port = int(os.getenv("PORT", 8000)) # Default to 8000 if PORT is not set
# Paths for SSL certificates
cert_path = "ssl/cert.pem"
key_path = "ssl/key.pem"
if environment == "test":
if is_ci:
# Use self-signed certificates for CI
cert_path = "ssl/cert.pem"
key_path = "ssl/key.pem"
host = "127.0.0.1" # In CI, bind to localhost
print("Using self-signed SSL certificates for CI...")
elif environment == "test":
# Use proper test certificates
cert_path = "ssl/mx-aare-test.psi.ch.pem"
key_path = "ssl/mx-aare-test.psi.ch.key"
host = "0.0.0.0" # Bind to all interfaces
host = "0.0.0.0" # In test, bind to all interfaces
print("Using test SSL certificates...")
else:
host = "127.0.0.1" # Default for other environments
# Use development self-signed certificates
cert_path = "ssl/cert.pem"
key_path = "ssl/key.pem"
host = "127.0.0.1" # Bind to localhost for dev
print("Using self-signed SSL certificates for development...")
# Run the application with appropriate SSL setup
uvicorn.run(