Skip to content

fix: respect XDG_CONFIG_HOME for collection config path#122

Open
jdvmi00 wants to merge 1 commit intotobi:mainfrom
jdvmi00:fix/xdg-config-home
Open

fix: respect XDG_CONFIG_HOME for collection config path#122
jdvmi00 wants to merge 1 commit intotobi:mainfrom
jdvmi00:fix/xdg-config-home

Conversation

@jdvmi00
Copy link
Contributor

@jdvmi00 jdvmi00 commented Feb 6, 2026

Problem

getConfigDir() in collections.ts is hardcoded to ~/.config/qmd, ignoring the XDG_CONFIG_HOME environment variable. This makes it impossible to run isolated QMD instances with separate collection configs on the same machine.

The store already respects XDG_CACHE_HOME for the SQLite database location, but the collection YAML config doesn't follow the same convention. When a host application (e.g. OpenClaw) sets both XDG_CACHE_HOME and XDG_CONFIG_HOME to isolate its QMD instance, the config still reads/writes from the shared ~/.config/qmd/index.yml, causing cross-environment collection pollution.

Fix

Check XDG_CONFIG_HOME in getConfigDir() before falling back to ~/.config/qmd, consistent with the XDG Base Directory Specification. QMD_CONFIG_DIR still takes precedence when set.

Changes

  • src/collections.ts: getConfigDir() now checks XDG_CONFIG_HOME$XDG_CONFIG_HOME/qmd

Priority: QMD_CONFIG_DIR > XDG_CONFIG_HOME/qmd > ~/.config/qmd

getConfigDir() was hardcoded to ~/.config/qmd, ignoring XDG_CONFIG_HOME.
This made it impossible to run isolated QMD instances with separate
collection configs on the same machine (e.g. when embedded by a host
application that sets XDG_CACHE_HOME + XDG_CONFIG_HOME).

The store already respects XDG_CACHE_HOME for the SQLite database
location — this makes config consistent with the XDG Base Directory spec.

QMD_CONFIG_DIR still takes precedence when set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant