Skip to content

Conversation

@ChingEnLin
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings October 28, 2025 10:18
@ChingEnLin ChingEnLin changed the title Releases Release Oct 28, 2025
@ChingEnLin ChingEnLin merged commit d098901 into production Oct 28, 2025
3 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements environment-based CORS configuration and adds a health check endpoint to differentiate between production and development environments. The changes enhance security by restricting allowed origins in production while maintaining development flexibility.

Key changes:

  • Adds environment-aware CORS configuration that uses strict origin whitelisting in production and localhost origins in development
  • Introduces a health check endpoint that reports the application's CORS mode
  • Configures the ENVIRONMENT=production variable in the Cloud Run deployment workflow

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
backend/main.py Implements environment detection logic, configures CORS middleware with environment-specific allowed origins, and adds health check endpoint
.github/workflows/google-cloudrun-docker.yml Sets ENVIRONMENT variable to production for Cloud Run deployment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +18 to +22
allowed_origins = [
"https://querypal.virtonomy.io", # Production frontend
"https://querypal-frontend-zynyyoxona-ew.a.run.app", # Cloud Run frontend URL (pattern)
# Add your actual Cloud Run frontend URL when you know it
]
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Cloud Run URL appears to be a placeholder pattern rather than an actual frontend URL. Consider using an environment variable for the frontend URL instead of hardcoding it, or remove this entry if it's not yet deployed.

Suggested change
allowed_origins = [
"https://querypal.virtonomy.io", # Production frontend
"https://querypal-frontend-zynyyoxona-ew.a.run.app", # Cloud Run frontend URL (pattern)
# Add your actual Cloud Run frontend URL when you know it
]
# Set allowed origins from FRONTEND_URLS env var (comma-separated), or default to production frontend
frontend_urls = os.getenv("FRONTEND_URLS")
if frontend_urls:
allowed_origins = [url.strip() for url in frontend_urls.split(",") if url.strip()]
else:
allowed_origins = [
"https://querypal.virtonomy.io", # Production frontend
]

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +33
print(f"🔧 CORS Configuration - Production mode: {is_production}")
print(f"🌐 Allowed origins: {allowed_origins}")
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use proper logging instead of print statements for production code. Consider using Python's logging module (e.g., logging.info()) which provides better control over log levels and output formats.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

🎉 This PR is included in version 2.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants