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

Credential loading doesn't respect XDG_CONFIG_HOME #932

Open
pcapel opened this issue Feb 15, 2023 · 1 comment
Open

Credential loading doesn't respect XDG_CONFIG_HOME #932

pcapel opened this issue Feb 15, 2023 · 1 comment

Comments

@pcapel
Copy link

pcapel commented Feb 15, 2023

  • Do not use the issues tracker for help or support (try Elixir Forum, Slack, IRC, etc.)
  • Questions about how to contribute are fine.

Environment

  • Elixir & Erlang versions (elixir --version):

    • Erlang/OTP 25 [erts-13.1.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
      Elixir 1.14.3 (compiled with Erlang/OTP 25)
  • ExAws version mix deps |grep ex_aws

    • ex_aws 2.4.1 (Hex package) (mix)
      locked at 2.4.1 (ex_aws) 803387db
  • HTTP client version. IE for hackney do mix deps | grep hackney

    • hackney 1.18.1 (Hex package) (rebar3)
      locked at 1.18.1 (hackney) a4ecdaff

Current behavior

Credentials are looked up in the home directory without respecting potential placement in XDG_CONFIG_HOME

Expected behavior

Specification compliance

I had set up some aliases a while back to get configuration where I expect it, since the cli compliance isn't quite there yet either. I should have remembered that, but definitely didn't! Took me a bit to figure out, but it wasn't too bad.

I'd say there are two enhancements that can be made here:

  1. Support searching in XDG_CONFIG/DATA_HOME for the required values
  2. Produce more appropriate errors/warnings surrounding the failure to locate expected files within directories

The primary issue is that the failure mode for an entry being missing is the same as the failure mode for not finding the configuration at all. Respecting the XDG spec isn't a huge deal to me personally, but it was a bit of a goose chase to figure out why things were failing when my configurations looked the same as a team mate's. Granted, I am the one who forgot about aliasing my config locations 😊 so that's on me!

I'd be happy to put in a little work to get a PR put together for one or both of the enhancements, depending on what is felt to be the best course for the project. I don't have a strong opinion personally as I'm relatively new to Elixir. I'd say that at the very least an error message that clearly delineates between a key not being set and the entire config file not being found is preferable to the current behavior.

Thanks for the project though! Works like a charm when I configure it correctly 😝

@bernardd
Copy link
Contributor

Hi @pcapel - thanks for the report :)
I'd be happy to consider PRs for both those things (as well as the crash on unset $HOME). XDG support isn't really on my radar at the moment, but if it can be done neatly without breaking anything else then I've got no objections to it.

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

No branches or pull requests

2 participants