MEDIUM: Hardcoded URLs and Configuration Values #8

Closed
opened 2026-02-16 22:09:38 +02:00 by Koko210 · 1 comment
Owner

Many URLs and configuration values are hardcoded in the codebase, making it difficult to change deployment targets or API endpoints.

Where It Occurs

  • bot/globals.py - LLM endpoints (LLAMA_URL, LLAMA_AMD_URL)
  • bot/config.py - Web UI URLs
  • bot/utils/llm.py - Direct URL references
  • bot/api.py - API base URLs

Why This Is a Problem

  1. Deployment Issues: Cannot deploy to different environments without code changes
  2. Maintenance: Changing API endpoints requires finding all references
  3. Testing: Cannot use mock endpoints for testing
  4. Security: Secrets may be accidentally committed

What Can Go Wrong

Scenario 1: Switching to New LLM Provider

  1. Team decides to switch from local LLM to OpenAI API
  2. Developer searches for all LLM URL references
  3. Misses one reference in utils/llm.py
  4. Bot still tries to call local LLM in one code path
  5. Bot fails randomly when that code path is executed

Scenario 2: Staging Environment

  1. Developer sets up staging environment
  2. Needs to use staging API endpoints
  3. Has to modify 15+ files to change URLs
  4. Accidentally commits staging URLs to production
  5. Production bot now calls staging APIs

Proposed Fix

Move all configuration to config.yaml and load via ConfigManager.

Severity

MEDIUM - Hardcoded values make deployment difficult and error-prone.

Files Affected

bot/globals.py, bot/config.py, bot/utils/llm.py, bot/api.py, config.yaml

Many URLs and configuration values are hardcoded in the codebase, making it difficult to change deployment targets or API endpoints. ## Where It Occurs - bot/globals.py - LLM endpoints (LLAMA_URL, LLAMA_AMD_URL) - bot/config.py - Web UI URLs - bot/utils/llm.py - Direct URL references - bot/api.py - API base URLs ## Why This Is a Problem 1. Deployment Issues: Cannot deploy to different environments without code changes 2. Maintenance: Changing API endpoints requires finding all references 3. Testing: Cannot use mock endpoints for testing 4. Security: Secrets may be accidentally committed ## What Can Go Wrong ### Scenario 1: Switching to New LLM Provider 1. Team decides to switch from local LLM to OpenAI API 2. Developer searches for all LLM URL references 3. Misses one reference in utils/llm.py 4. Bot still tries to call local LLM in one code path 5. Bot fails randomly when that code path is executed ### Scenario 2: Staging Environment 1. Developer sets up staging environment 2. Needs to use staging API endpoints 3. Has to modify 15+ files to change URLs 4. Accidentally commits staging URLs to production 5. Production bot now calls staging APIs ## Proposed Fix Move all configuration to config.yaml and load via ConfigManager. ## Severity MEDIUM - Hardcoded values make deployment difficult and error-prone. ## Files Affected bot/globals.py, bot/config.py, bot/utils/llm.py, bot/api.py, config.yaml
Koko210 reopened this issue 2026-02-16 22:17:02 +02:00
Author
Owner

Closing as Invalid - All URLs are already environment-configurable, not hardcoded. In bot/globals.py lines 25-26 and 36, all URLs use os.getenv() with Docker service name defaults: LLAMA_URL, LLAMA_AMD_URL, and CHESHIRE_CAT_URL. This is the standard pattern for docker-compose deployments. The defaults are appropriate Docker service names that work in the compose network.

Closing as Invalid - All URLs are already environment-configurable, not hardcoded. In bot/globals.py lines 25-26 and 36, all URLs use os.getenv() with Docker service name defaults: LLAMA_URL, LLAMA_AMD_URL, and CHESHIRE_CAT_URL. This is the standard pattern for docker-compose deployments. The defaults are appropriate Docker service names that work in the compose network.
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#8