-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
replace XDG Directory configuration to standard os.UserConfigDir #2826
Conversation
Thanks for the PR, but I think this needs some more discussion first. We've had a lot of feature requests for XDG though (#847 is just some of them). If you don't want to use it, you don't have to use it. I do not think it is harmful to support it by default.
Which "non-standard, complex third party packages" are we using for it?
The problem with this is that this function returns the user's config directory, not their data directory:
But we need the data directory, $XDG_DATA_DIR.
I don't understand why that is fragile. |
Obviously, there was not enough explanation.
I also think it is good to support it by default. Only problem with XDG base directory is that is absolutely Linux specific. What I meant is that to support this stuffs in more robust way, we might need to implement / use third party libraies like this. https://github.com/shibukawa/configdir. As most reliable go standard library is provided to fix this, I think It would be better to use it.
golang/go#29960 explains about, XDG_DATA_HOME vs XDG_CONFIG_HOME
I shouldn't have said that as I can't explain exact reason for this. |
@mholt any more thoughts with this? |
@aca Sort of, I still need to think about it more...
It is kind of nice to have everything in one place no matter the OS -- makes troubleshooting and documentation easier. Plus, I suppose it is more likely that the process will have write permissions to the $HOME folder than other paths in the file system. But I can also see the benefit of adopting an OS's usual storage paths...
Ah, that's because that function returns the literal, expanded path of the current directory. Whereas using |
Going to close this for now since I don't think it's quite the right solution (I'm still not convinced it's important to change what we have, as it's not really broken AFAIK). |
1. Which version of Caddy are you using (
caddy -version
)?v2
2. What are you trying to do?
Remove xdg config directory for universal support.
v2 introduces XDG specification.
While it is popular in linux, It's only for linux.
I don't think we need non-standard, complex third party packages for this.
But as go 1.13 now has os.UserConfigDir I think we should use it.
If we simply use os.UserConfigDir, we can also just remove homedir.(#2770)
os.UserConfigDir uses XDG_CONFIG_HOME instead of XDG_CONFIG_DATA for linux.
But it seems quite common. golang/go#29960 (comment)
And getting current directory using "." is too fragile process. Replaced it with proper function.
3. Which documentation changes (if any) need to be made because of this PR?
cancel xdg configuration
4. Checklist