Configuration file location

TL;DR - XDG_CONFIG_HOME is not respected on some platforms.

The configuration code relies on os.UserConfigDir() which says (formatting by me):

On Unix systems, it returns $XDG_CONFIG_HOME if non-empty, else $HOME/.config.

On Darwin, it returns $HOME/Library/Application Support.

On Windows, it returns %AppData%.

On Plan 9, it returns $home/lib.

Ideally the configuration code would respect XDG_CONFIG_HOME even on MacOS for example. I think that's typical for CLI tools. Otherwise, the README should tell users where to put the file based on their platform.

Assigned to
6 months ago
6 months ago
No labels applied.

~emersion REPORTED FIXED 6 months ago

The man page already explains that the config file location changes on macOS.

~crg 6 months ago

Where does it say that? This is what I can see:

           Explicitly select a configuration file that should be used over the default configuration.
       Generate a new OAuth2 access token on meta.sr.ht.

       On startup hut will look for a file at $XDG_CONFIG_HOME/hut/config. If unset, $XDG_CONFIG_HOME defaults to ~/.config/.

           instance "sr.ht" {
                access-token "<token>"
                # As an alternative you can specify a command whose first line of output
                # will be parsed as the token
                access-token-cmd pass token

~emersion 6 months ago

Ah, I though we merged this patch, but apparently not: https://lists.sr.ht/~emersion/hut-dev/%3C20211227121318.11270-1-m%40mrcus.dev%3E

Register here or Log in to comment, or comment via email.