Skip to content

Allow clickhouse-client config file in XDG-compliant location #89882

@ramazanpolat

Description

@ramazanpolat

Company or project name

No response

Describe the improvement

Current behavior

clickhouse-client expects its configuration file to be located at ~/.clickhouse-client/config.xml.
Reference: ClickHouse CLI configuration documentation

This approach contributes to home directory clutter. Many command-line tools still use this convention, resulting in numerous dotfiles that make the home folder disorganized and harder to manage.

Proposed improvement

Adopt the XDG Base Directory Specification by default, placing the config file in:

~/.config/clickhouse-client/config.xml

while still supporting the legacy path for backward compatibility.

I think this will show how bad it becomes after some time:

Image

Apparently I'm not the only one that's bothered by home folder pollution: https://github.com/b3nj5m1n/xdg-ninja

Also, there are already handful of tools supporting that:

Image

Cleaner home directory: Aligns with modern CLI design and avoids unnecessary dotfiles in ~/.
Consistency: Matches behavior of other modern CLI tools such as kubectl, gh, aws, and git.
Ease of configuration management: Centralizes configurations under ~/.config/, improving maintainability and backup workflows.

Suggested implementation

  1. Check ~/.config/clickhouse-client/config.xml by default.
  2. Fall back to ~/.clickhouse-client/config.xml if the XDG path does not exist.
  3. Optionally, respect $XDG_CONFIG_HOME if defined.

Which ClickHouse versions are affected?

All

How to reproduce

Not applicable

Error message and/or stacktrace

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions