Skip to content

fix(settings): add missing ADMINS, VIDEO_SERVER_HOSTNAME, CACHE_TICKE…#2976

Draft
Rachit7168 wants to merge 29 commits intofossasia:devfrom
Rachit7168:fix/undefined-settings-clean
Draft

fix(settings): add missing ADMINS, VIDEO_SERVER_HOSTNAME, CACHE_TICKE…#2976
Rachit7168 wants to merge 29 commits intofossasia:devfrom
Rachit7168:fix/undefined-settings-clean

Conversation

@Rachit7168
Copy link
Copy Markdown
Contributor

@Rachit7168 Rachit7168 commented Mar 24, 2026

Add ADMINS, VIDEO_SERVER_HOSTNAME, CACHE_TICKETS_HOURS, FETCH_ECB_RATES to settings. Code was trying to access these but they weren't defined.

Partial part of Issue : #1546
and inactive PR : #2154

Summary by Sourcery

Define missing configuration settings and wire them into Django settings, including safer handling when the video server is not configured.

Bug Fixes:

  • Expose ADMINS, VIDEO_SERVER_HOSTNAME, CACHE_TICKETS_HOURS, and FETCH_ECB_RATES via the settings config to prevent runtime access to undefined settings.
  • Skip video world creation when VIDEO_SERVER_HOSTNAME is not configured, avoiding errors in background tasks.

Copilot AI review requested due to automatic review settings March 24, 2026 16:29
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 24, 2026

Reviewer's Guide

Adds missing configuration settings (ADMINS, VIDEO_SERVER_HOSTNAME, CACHE_TICKETS_HOURS, FETCH_ECB_RATES) to the central config and wires them into Django settings, plus guards video world creation when the video server hostname is not configured.

Sequence diagram for video world creation with VIDEO_SERVER_HOSTNAME guard

sequenceDiagram
    participant TasksModule as eventyay_common_tasks
    participant Settings as Django_settings
    participant VideoServer as Video_server

    TasksModule->>Settings: read VIDEO_SERVER_HOSTNAME
    alt VIDEO_SERVER_HOSTNAME not set
        Settings-->>TasksModule: None
        TasksModule->>TasksModule: log warning and return None
    else VIDEO_SERVER_HOSTNAME set
        Settings-->>TasksModule: base URL
        TasksModule->>TasksModule: build payload and headers
        TasksModule->>VideoServer: POST /worlds with payload
        VideoServer-->>TasksModule: response or error
    end
Loading

Class diagram for updated BaseSettings configuration fields

classDiagram
    class BaseSettings {
        bool admin_audit_comments_asked
        str call_for_speaker_login_button_label
        list~tuple~ admins
        HttpUrl video_server_hostname
        int cache_tickets_hours
        bool fetch_ecb_rates
    }

    class ConfProxy {
        +linkedin_client_id
        +linkedin_client_secret
        +admins
        +video_server_hostname
        +cache_tickets_hours
        +fetch_ecb_rates
    }

    class DjangoSettingsModule {
        +ADMINS
        +VIDEO_SERVER_HOSTNAME
        +CACHE_TICKETS_HOURS
        +FETCH_ECB_RATES
    }

    ConfProxy <|-- BaseSettings
    ConfProxy --> DjangoSettingsModule : provides_values_for
Loading

Flow diagram for conditional use of external video server

flowchart TD
    A[Eventyay app _create_world task] --> B{VIDEO_SERVER_HOSTNAME configured?}
    B -- No --> C[Log warning and skip video world creation]
    B -- Yes --> D[Build video traits and payload]
    D --> E[Call external video server API]
    E --> F[Process response]
Loading

File-Level Changes

Change Details Files
Introduce new config fields for admins, video server hostname, ticket cache duration, and ECB rate fetching in BaseSettings and expose them as Django-style settings constants.
  • Add admins list field (name, email tuples) to BaseSettings with default empty list.
  • Add optional video_server_hostname HttpUrl field to BaseSettings to represent external video server base URL.
  • Add cache_tickets_hours integer field with a default of 24 and minimum of 1 hour to BaseSettings.
  • Add fetch_ecb_rates boolean feature toggle field to BaseSettings with default False.
  • Create global ADMINS, VIDEO_SERVER_HOSTNAME, CACHE_TICKETS_HOURS, and FETCH_ECB_RATES settings that map directly from the new BaseSettings fields.
app/eventyay/config/settings.py
Prevent video world creation when VIDEO_SERVER_HOSTNAME is not configured and log a warning instead.
  • Insert configuration check for VIDEO_SERVER_HOSTNAME at the beginning of the _create_world helper.
  • Log a clear warning and return early when the video server hostname is missing to avoid misconfigured video world creation attempts.
app/eventyay/eventyay_common/tasks.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
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 addresses runtime AttributeError incidents caused by code referencing undefined Django settings by introducing the missing configuration keys in the centralized settings module and adding a safe-guard in the video world creation task.

Changes:

  • Add ADMINS, VIDEO_SERVER_HOSTNAME, CACHE_TICKETS_HOURS, and FETCH_ECB_RATES to app/eventyay/config/settings.py (Pydantic config fields + exported Django settings constants).
  • Skip video world creation in create_world when VIDEO_SERVER_HOSTNAME is not configured, avoiding invalid URL usage and noisy task failures.

Reviewed changes

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

File Description
app/eventyay/eventyay_common/tasks.py Adds a configuration guard to skip video world creation when VIDEO_SERVER_HOSTNAME is unset.
app/eventyay/config/settings.py Defines missing settings in BaseSettings and exports corresponding uppercase Django settings constants.

Copilot AI review requested due to automatic review settings March 25, 2026 10:36
Copy link
Copy Markdown
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

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

Copilot AI review requested due to automatic review settings March 26, 2026 08:07
Copy link
Copy Markdown
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

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

Copilot AI review requested due to automatic review settings March 27, 2026 08:06
Copy link
Copy Markdown
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

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

Copilot AI review requested due to automatic review settings March 29, 2026 13:10
Copy link
Copy Markdown
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

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

@Rachit7168
Copy link
Copy Markdown
Contributor Author

@hongquan ,
This PR is ready to be reviewed

Copilot AI review requested due to automatic review settings April 1, 2026 03:25
Copy link
Copy Markdown
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

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

@hongquan
Copy link
Copy Markdown
Member

hongquan commented Apr 2, 2026

Please learn from #2154

@Rachit7168 Rachit7168 marked this pull request as draft April 2, 2026 08:50
Copilot AI review requested due to automatic review settings April 2, 2026 11:49
Copy link
Copy Markdown
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

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

Copilot AI review requested due to automatic review settings April 3, 2026 11:11
Copy link
Copy Markdown
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

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

Copilot AI review requested due to automatic review settings April 7, 2026 02:55
Copy link
Copy Markdown
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

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

Copilot AI review requested due to automatic review settings April 11, 2026 15:37
Copy link
Copy Markdown
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

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

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants