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

Support $XDG_CONFIG_HOME for config file #1521

Closed
ptman opened this issue Mar 15, 2023 · 5 comments · Fixed by #2059
Closed

Support $XDG_CONFIG_HOME for config file #1521

ptman opened this issue Mar 15, 2023 · 5 comments · Fixed by #2059

Comments

@ptman
Copy link

ptman commented Mar 15, 2023

Instead of only looking for the config file in ~/.sentryclirc please follow https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html and look in $XDG_CONFIG_HOME/sentry/cli.ini (or similar) or $HOME/.config/sentry/cli.ini if $XDG_CONFIG_HOME is unset.

There is even a nice Rust library for this: https://docs.rs/xdg/ https://github.com/whitequark/rust-xdg

@kamilogorek
Copy link
Contributor

There is only a single place it needs to be updated at -

sentry-cli/src/config.rs

Lines 455 to 462 in a29838b

fn find_global_config_file() -> Result<PathBuf> {
dirs::home_dir()
.ok_or_else(|| format_err!("Could not find home dir"))
.map(|mut path| {
path.push(CONFIG_RC_FILE_NAME);
path
})
}

I'm happy to assist if you'd like to submit a PR :)

@evanpurkhiser
Copy link
Member

Would LOVE to see this get done!

@evanpurkhiser
Copy link
Member

We'll have to make sure we first try reading from the legacy path

@github-actions
Copy link

This issue 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 🥀

@szokeasaurusrex
Copy link
Member

@elramen Looks like there is already a partially completed PR (#1744) you could continue working on, or use as inspiration for this change

elramen added a commit that referenced this issue May 2, 2024
Enable discovery of the global sentry-cli config file in paths /sentry/sentrycli.ini and /Users/eliasram/.config/sentry/sentrycli.ini, allowing users to adhere to the XDG specifications

Fixes GH-1521
elramen added a commit that referenced this issue May 2, 2024
If .sentryclirc does not exist, look for the global config file in $XDG_CONFIG_HOME/sentry/sentrycli.ini and $HOME/.config/sentry/sentrycli.ini, allowing users to adhere to the XDG specifications.

Fixes GH-1521
elramen added a commit that referenced this issue May 27, 2024
If the global config file does not exist in the home directory, look in the following paths:
- Linux: $XDG_CONFIG_HOME/sentry/sentrycli.ini and $HOME/.config/sentry/sentrycli.ini
- Mac: $HOME/Library/Application Support/sentry/sentrycli.ini
- Windows: {FOLDERID_RoamingAppData}
This enables users to keep their home dir clean, adhering to standards such as XDG on linux.

Fixes GH-1521
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.

5 participants