Skip to content

Add support for $XDG_CONFIG_HOME file - #1744

Closed
boozec wants to merge 1 commit into
getsentry:masterfrom
boozec:add-support-for-xdg-config
Closed

boozec wants to merge 1 commit into
getsentry:masterfrom
boozec:add-support-for-xdg-config

Conversation

@boozec

@boozec boozec commented Sep 14, 2023

Copy link
Copy Markdown
Contributor

Hi all, this PR adds the support for $XDG_CONFIG_HOME. The default global file is now located at
$XDG_CONFIG_HOME/sentry/cli.ini (issue #1521).

env is still used for local config but dirs is still used for dump_response, debug_files and cache_dir. Maybe, at least cache_dir, should be moved to xdg?

The default global file is now located at
`$XDG_CONFIG_HOME/sentry/cli.ini`
@boozec

boozec commented Sep 14, 2023 •

Copy link
Copy Markdown
Contributor Author

Umh, I forgot about Windows. Where should the config file be located? Or, should we keep the current file for a Windows environement?

If we keep the current file, we could also use it for a legacy issue.

@loewenheim

Copy link
Copy Markdown
Contributor

Hi, thank you for the PR. Supporting XDG directories is a good idea, but this won't work as-is. It would break anyone who currently has a .sentryclirc file in their home directory. There at least needs to be backwards compatibility for that.

As for Windows, that could be solved by using the dirs crate instead of xdg, although it should be noted that dirs doesn't use XDG directories on macOS, but the standard Mac directories. We'd have to have a conversation about which makes more sense here.

@boozec

boozec commented Sep 15, 2023 •

Copy link
Copy Markdown
Contributor Author

Hi @loewenheim, thank you for the reply.

It would break anyone who currently has a .sentryclirc file in their home directory.

I think we could search for .sentryclirc and if it does not exist we search in $XDG_CONFIG_HOME dir.

dirs doesn't use XDG directories on macOS

same as above.

Or, instead of xdg we could use dirs::config_dir for each OS, so we have:

// Lin: Some(/home/alice/.config/sentry)
// Win: Some(C:\Users\Alice\AppData\Roaming\sentry)
// Mac: Some(/Users/Alice/Library/Application Support/sentry)

Another way could be a SENTRY_CONFIG_DIR env used by default if someone wants to put the data into another folder (this could be confusing if we also have to manage the local .sentryclirc and the $XDG_CONFIG_HOME).


Anyway, I'm converting this PR to draft for now

@boozec
boozec marked this pull request as draft September 15, 2023 09:11
@ashwoods ashwoods self-assigned this Oct 2, 2023
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

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.

3 participants