[PR #276] [MERGED] feat: add command line config overrides support #286

Closed
opened 2026-02-28 14:26:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/devgianlu/go-librespot/pull/276
Author: @YutongGu
Created: 12/24/2025
Status: Merged
Merged: 12/24/2025
Merged by: @devgianlu

Base: masterHead: conf-override


📝 Commits (1)

  • b2ddc97 feat: add command line config overrides support

📊 Changes

1 file changed (+24 additions, -0 deletions)

View changed files

📝 cmd/daemon/main.go (+24 -0)

📄 Description

Description

This PR adds the ability to override configuration values from the command line without modifying the YAML config file.
This is useful for:

  • Testing different configurations quickly
  • Running multiple instances with slightly different settings
  • Scripting and automation
  • Overriding specific values in containerized environments

Usage

# Override a single field
go-librespot -c device_name=MyDevice

# Override nested fields using dot notation
go-librespot --conf server.address=0.0.0.0 --conf server.port=8080

# Multiple overrides
go-librespot -c device_type=speaker -c bitrate=320 -c credentials.type=interactive

# Mix with other flags
go-librespot --config_dir /custom/path -c zeroconf_enabled=true

Configuration Priority

Overrides are applied after all other configuration sources, giving them the highest priority:

  1. -c/--conf overrides ← highest priority
  2. Other command line flags
  3. YAML config file (config.yaml / config.yml)
  4. Default values ← lowest priority

Changes

  • Added -c/--conf flag using StringArrayVarP to accept multiple override values
  • Parses each override in field=value format
  • Supports nested fields via dot notation (e.g., server.address, credentials.type)
  • Includes validation for malformed overrides (missing =, empty field names)

Error Handling

The following cases produce clear error messages:

  • Missing = separator: invalid config override format: fieldvalue (expected field=value)
  • Empty field name: invalid config override: empty field name in =value

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/devgianlu/go-librespot/pull/276 **Author:** [@YutongGu](https://github.com/YutongGu) **Created:** 12/24/2025 **Status:** ✅ Merged **Merged:** 12/24/2025 **Merged by:** [@devgianlu](https://github.com/devgianlu) **Base:** `master` ← **Head:** `conf-override` --- ### 📝 Commits (1) - [`b2ddc97`](https://github.com/devgianlu/go-librespot/commit/b2ddc975b33598e5063bd325897da44ea42dbd1d) feat: add command line config overrides support ### 📊 Changes **1 file changed** (+24 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/daemon/main.go` (+24 -0) </details> ### 📄 Description ## Description This PR adds the ability to override configuration values from the command line without modifying the YAML config file. This is useful for: - Testing different configurations quickly - Running multiple instances with slightly different settings - Scripting and automation - Overriding specific values in containerized environments ## Usage ``` # Override a single field go-librespot -c device_name=MyDevice # Override nested fields using dot notation go-librespot --conf server.address=0.0.0.0 --conf server.port=8080 # Multiple overrides go-librespot -c device_type=speaker -c bitrate=320 -c credentials.type=interactive # Mix with other flags go-librespot --config_dir /custom/path -c zeroconf_enabled=true ``` ## Configuration Priority Overrides are applied after all other configuration sources, giving them the highest priority: 1. -c/--conf overrides ← highest priority 2. Other command line flags 3. YAML config file (config.yaml / config.yml) 4. Default values ← lowest priority ## Changes * Added -c/--conf flag using StringArrayVarP to accept multiple override values * Parses each override in field=value format * Supports nested fields via dot notation (e.g., server.address, credentials.type) * Includes validation for malformed overrides (missing =, empty field names) ## Error Handling The following cases produce clear error messages: * Missing = separator: invalid config override format: fieldvalue (expected field=value) * Empty field name: invalid config override: empty field name in =value --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:26:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#286
No description provided.