Skip to content

Add pre-production environment configuration and API URL support#14

Open
Lazare-42 wants to merge 1 commit intomainfrom
add_preprod
Open

Add pre-production environment configuration and API URL support#14
Lazare-42 wants to merge 1 commit intomainfrom
add_preprod

Conversation

@Lazare-42
Copy link
Contributor

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 5, 2025

Summary by CodeRabbit

  • New Features
    • Added a new pre-production deployment configuration for the application, including a dedicated domain and environment settings.
  • Improvements
    • Updated configuration to support dynamic API endpoint selection via environment variables, enabling easier switching between production and pre-production environments.
    • Enhanced OpenAPI documentation by adding a pre-production server entry.
    • Improved formatting consistency in API documentation and configuration files.

Walkthrough

This 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

File(s) Change Summary
app/main.py Reformatted OpenAPI schema definitions, added pre-production server entry to servers list, no logic changes.
fly.preprod.toml New configuration file for Fly.io pre-production deployment with environment, domain, and resource settings.
fly.toml Updated production Fly.io config: added API_URL env var and domain configuration for production deployment.
scripts/meetingbaas_api.py API base URL now read from API_URL environment variable, allowing dynamic endpoint configuration.

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
Loading

Possibly related PRs

Poem

🐇
In configs and schemas, we tidied the lines,
Preprod now lives where the staging sun shines.
API URLs from the air we now pluck,
No more hardcoding—just set and good luck!
Domains aligned, environments set,
With a hop and a skip, we’re not done yet!
—Your friendly coding rabbit

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b6a372 and 75c62f5.

📒 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 new API_URL setting enables the application to dynamically pick up the correct MeetingBaas API endpoint at runtime.


23-25: Configure production HTTP service domains
The domain speaking.meetingbaas.com with zone meetingbaas.com is correctly added under http_service.domains.

scripts/meetingbaas_api.py (4)

3-3: Import os for environment variable access
The os import is necessary to read API_URL from the environment.


12-14: Use environment variable for API base URL
Reading API_URL with 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 with f"{api_base_url}/bots" ensures the function honors the API_URL env var.


226-226: Use dynamic base URL in leave_meeting_bot
The delete URL now correctly uses api_base_url, matching the create path configuration.

fly.preprod.toml (4)

11-14: Add pre-production environment variables
Defines PORT=8766 and API_URL=https://api.pre-prod-meetingbaas.com for 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 domain speaking.pre-prod-meetingbaas.com under zone pre-prod-meetingbaas.com is 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 in securitySchemes dict
The trailing comma improves formatting consistency and eases future schema additions.


104-106: Add description for PersonaImageRequest.name
Documenting the name property enhances the OpenAPI schema’s readability.


108-110: Add description for PersonaImageRequest.description
Provides clear guidance on the property’s purpose in the generated schema.


112-115: Add enum for PersonaImageRequest.gender
Specifying allowed values (male, female, non-binary) improves validation and documentation.


117-121: Define items schema and description for PersonaImageRequest.characteristics
Specifying {"type": "string"} for array items and adding a description clarifies this property.


126-129: Add description for PersonaImageResponse.name
Clarifies the purpose of the name field in the response model.


130-133: Add description for PersonaImageResponse.image_url
Documents that this field holds the URL of the generated image.


135-139: Add description for PersonaImageResponse.generated_at
Improves schema documentation by explaining the timestamp format.


150-161: Reformat requestBody for /personas/generate-image endpoint
Switching to a multi-line block with trailing commas makes the schema assignment clearer and ensures the PersonaImageRequest reference 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
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 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)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments