Skip to content

feat(config): honor DISPATCH_CONFIG to override config file path#300

Merged
jongio merged 1 commit into
mainfrom
idea/config-path-env
Jul 13, 2026
Merged

feat(config): honor DISPATCH_CONFIG to override config file path#300
jongio merged 1 commit into
mainfrom
idea/config-path-env

Conversation

@jongio

@jongio jongio commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Closes #295

Summary

Adds a DISPATCH_CONFIG environment variable that overrides the config file path. Point it at an absolute file path to keep separate profiles (for example work and personal) without editing JSON by hand.

The override is resolved in one place, configPath(), so every consumer follows it:

  • dispatch config path / get / set / edit
  • dispatch doctor
  • config Load and Save

A relative or UNC value is ignored and the default OS config location is used instead. This mirrors the guard already applied to the log file path, so the override cannot point at a network share or a path relative to the current directory.

Verification

  • go build ./...
  • go test ./... (added 4 tests in internal/config for override, save/load round-trip, relative + UNC rejection, and unset falls back to default)
  • go vet ./...
  • golangci-lint run --timeout 10m (0 issues)
  • mage deadcode (OK)
  • README updated: new Configuration note plus a DISPATCH_CONFIG row in the Environment Variables table

Set DISPATCH_CONFIG to an absolute file path to point dispatch at a
different config file, which makes it easy to keep separate profiles
without editing JSON by hand. The override flows through configPath(),
so config path/get/set/edit and doctor all follow it.

A relative or UNC value is ignored and the default OS config location is
used, matching the guard already applied to the log file path.

Closes #295

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 12, 2026
@jongio jongio self-assigned this Jul 12, 2026
@jongio jongio merged commit f37bc9b into main Jul 13, 2026
2 checks passed
@jongio jongio deleted the idea/config-path-env branch July 13, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add DISPATCH_CONFIG env var to override the config file path

1 participant