Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

respect the XDG_CONFIG_HOME environment variable #1048

Closed
carlwgeorge opened this issue Dec 7, 2015 · 6 comments
Closed

respect the XDG_CONFIG_HOME environment variable #1048

carlwgeorge opened this issue Dec 7, 2015 · 6 comments

Comments

@carlwgeorge
Copy link

Thank you for using ~/.config/hub for your configuration file, as opposed to polluting the base home directory with yet another top-level dot file (~/.hub).

It would be even better if this configuration file was relocatable. This is covered by the XDG Base Directory Specification. Basically, this means to check for the environment variable XDG_CONFIG_HOME. If it exists, make your configuration file relative to that (${XDG_CONFIG_HOME}/hub). If it does not exist, make your configuration file relative to ~/.config (matching the existing behavior). Because you are already using the default relative path, it would be a backwards compatible change for existing users.

@ghost
Copy link

ghost commented Dec 7, 2015

it would also match git. Git also supports the XDG Base Directory Specification.

@mislav
Copy link
Owner

mislav commented Dec 8, 2015

Thanks for the suggestion! This is definitely something we could do. Now accepting pull requests 😉

@purpleKarrot
Copy link

purpleKarrot commented Apr 25, 2016

Also, please store sensitive information (like oauth_token) under $XDG_CACHE_HOME, not $XDG_CONFIG_HOME. The latter location is often published in dotfiles, the former is usually not.

@mislav mislav closed this as completed in f8bd902 Jun 7, 2018
@ghost
Copy link

ghost commented Jun 8, 2018

$XDG_CACHE_HOME can disappear at any time though. It'd be best if it stored in the system keyring, but $XDG_DATA_HOME could be used instead.

@dsifford
Copy link
Contributor

Agree with @jrobeson -- This should definitely be $XDG_DATA_HOME...

And, further, the canonical way of utilizing those directories is for applications to create a directory for which a config, data, or cache files will then reside in, rather than putting a single file at the base of the XDG directory.

So, as an example, the ideal scenario I think would be $XDG_DATA_HOME/hub/auth rather than the current $XDG_CONFIG_HOME/hub format.

@ghost
Copy link

ghost commented Jul 20, 2018

I think storing it as a single file is fine IF it were to be the only file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants