Add pre-production environment configuration and API URL support#14
Add pre-production environment configuration and API URL support#14
Conversation
Summary by CodeRabbit
WalkthroughThis set of changes introduces a new Fly.io configuration file for a pre-production environment, updates the existing production Fly.io configuration with domain and environment variable adjustments, and modifies the API base URL handling in the meeting API script to use an environment variable. Additionally, the OpenAPI schema in the main application is reformatted for consistency, and a new pre-production server entry is added to the OpenAPI servers list. No functional changes are made to the application logic, control flow, or public APIs. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant MeetingBaasAPI
User->>App: Sends request (e.g., create/leave meeting)
App->>scripts/meetingbaas_api.py: Calls function (reads API_URL from env)
scripts/meetingbaas_api.py->>MeetingBaasAPI: Sends request to configured API endpoint
MeetingBaasAPI-->>scripts/meetingbaas_api.py: Returns response
scripts/meetingbaas_api.py-->>App: Returns result
App-->>User: Returns API response
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
app/main.py(5 hunks)fly.preprod.toml(1 hunks)fly.toml(3 hunks)scripts/meetingbaas_api.py(4 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
app/main.py
9-9: fastapi.HTTPException imported but unused
Remove unused import: fastapi.HTTPException
(F401)
🔇 Additional comments (21)
fly.toml (2)
13-13: Add production API_URL environment variable
The newAPI_URLsetting enables the application to dynamically pick up the correct MeetingBaas API endpoint at runtime.
23-25: Configure production HTTP service domains
The domainspeaking.meetingbaas.comwith zonemeetingbaas.comis correctly added underhttp_service.domains.scripts/meetingbaas_api.py (4)
3-3: Importosfor environment variable access
Theosimport is necessary to readAPI_URLfrom the environment.
12-14: Use environment variable for API base URL
ReadingAPI_URLwith a sensible default (https://api.meetingbaas.com) makes the client flexible across environments.
179-179: Use dynamic base URL in create_meeting_bot
Replacing the hardcoded endpoint withf"{api_base_url}/bots"ensures the function honors theAPI_URLenv var.
226-226: Use dynamic base URL in leave_meeting_bot
The delete URL now correctly usesapi_base_url, matching the create path configuration.fly.preprod.toml (4)
11-14: Add pre-production environment variables
DefinesPORT=8766andAPI_URL=https://api.pre-prod-meetingbaas.comfor the pre-production deployment.
15-22: Configure HTTP service for pre-production
Settings mirror production: HTTPS enforcement, machine auto-start, and one machine minimum—appropriate for a staging environment.
23-25: Set pre-production domain
The domainspeaking.pre-prod-meetingbaas.comunder zonepre-prod-meetingbaas.comis correctly configured.
27-30: Allocate VM resources for pre-production
2 GB memory and 2 shared CPUs are specified; this aligns with production resource allocations.app/main.py (11)
38-40: Approve multi-line JSONResponse content formatting
The middleware’s 401 response is now split across lines for clarity without altering behavior.
95-95: Add trailing comma insecuritySchemesdict
The trailing comma improves formatting consistency and eases future schema additions.
104-106: Add description forPersonaImageRequest.name
Documenting thenameproperty enhances the OpenAPI schema’s readability.
108-110: Add description forPersonaImageRequest.description
Provides clear guidance on the property’s purpose in the generated schema.
112-115: Add enum forPersonaImageRequest.gender
Specifying allowed values (male,female,non-binary) improves validation and documentation.
117-121: Define items schema and description forPersonaImageRequest.characteristics
Specifying{"type": "string"}for array items and adding a description clarifies this property.
126-129: Add description forPersonaImageResponse.name
Clarifies the purpose of thenamefield in the response model.
130-133: Add description forPersonaImageResponse.image_url
Documents that this field holds the URL of the generated image.
135-139: Add description forPersonaImageResponse.generated_at
Improves schema documentation by explaining the timestamp format.
150-161: Reformat requestBody for/personas/generate-imageendpoint
Switching to a multi-line block with trailing commas makes the schema assignment clearer and ensures thePersonaImageRequestreference is correctly applied.
168-171: Add pre-production server to OpenAPI servers list
Documents the new internal pre-production environment in the generated API specification.
| from typing import Dict, List, Optional, Tuple | ||
|
|
||
| from fastapi import FastAPI, Request, HTTPException, status | ||
| from fastapi import FastAPI, HTTPException, Request, status |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Remove unused import HTTPException
The HTTPException import is not used anywhere in this module and can be safely removed to clean up imports.
🧰 Tools
🪛 Ruff (0.8.2)
9-9: fastapi.HTTPException imported but unused
Remove unused import: fastapi.HTTPException
(F401)
No description provided.