LOW: Move hardcoded user IDs and IP addresses to configuration #38

Open
opened 2026-02-20 14:48:21 +02:00 by Koko210 · 0 comments
Owner

Problem

Several hardcoded values are scattered throughout the codebase that should be configurable:

1. Hardcoded User ID in scheduled.py

In bot/utils/scheduled.py (around line 113), the user ID 214857593045254151 is hardcoded and always added to bedtime reminder targets regardless of which server is being processed. This means one specific user gets bedtime reminders from every server the bot is in, even if they are not a member.

2. Hardcoded IP addresses in uno_game.py

In bot/utils/uno_game.py (around line 22), the UNO server URLs are hardcoded:

These should be configurable via config.yaml or environment variables so the UNO server can be relocated without code changes.

3. Other potential hardcoded values

A broader audit may reveal additional hardcoded URLs, user IDs, or channel IDs. These should all be extracted to configuration.

Proposed Solution

  1. Add to config.yaml:
    scheduled:
    bedtime_always_include_users: [214857593045254151]
    uno:
    api_url: http://192.168.1.2:5000
    client_url: http://192.168.1.2:3002

  2. Read these from the unified config system (see related issue on config unification)

  3. Audit codebase for other hardcoded values:
    grep -rn '192.168.' bot/
    grep -rn '[0-9]{17,19}' bot/ (Discord snowflake IDs)

Impact

  • Risk: None
  • Effort: Trivial
  • Benefit: Deployment flexibility, no code changes needed for different environments

Files Affected

  • bot/utils/scheduled.py
  • bot/utils/uno_game.py
  • config.yaml (add new keys)
## Problem Several hardcoded values are scattered throughout the codebase that should be configurable: ### 1. Hardcoded User ID in scheduled.py In bot/utils/scheduled.py (around line 113), the user ID 214857593045254151 is hardcoded and always added to bedtime reminder targets regardless of which server is being processed. This means one specific user gets bedtime reminders from every server the bot is in, even if they are not a member. ### 2. Hardcoded IP addresses in uno_game.py In bot/utils/uno_game.py (around line 22), the UNO server URLs are hardcoded: - http://192.168.1.2:5000 (API endpoint) - http://192.168.1.2:3002 (game client) These should be configurable via config.yaml or environment variables so the UNO server can be relocated without code changes. ### 3. Other potential hardcoded values A broader audit may reveal additional hardcoded URLs, user IDs, or channel IDs. These should all be extracted to configuration. ## Proposed Solution 1. Add to config.yaml: scheduled: bedtime_always_include_users: [214857593045254151] uno: api_url: http://192.168.1.2:5000 client_url: http://192.168.1.2:3002 2. Read these from the unified config system (see related issue on config unification) 3. Audit codebase for other hardcoded values: grep -rn '192\.168\.' bot/ grep -rn '[0-9]\{17,19\}' bot/ (Discord snowflake IDs) ## Impact - Risk: None - Effort: Trivial - Benefit: Deployment flexibility, no code changes needed for different environments ## Files Affected - bot/utils/scheduled.py - bot/utils/uno_game.py - config.yaml (add new keys)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Koko210/miku-discord#38