di-sukharev / opencommit

Generate conventional git commit messages with AI in 1 second 🤯🔫
https://www.npmjs.com/package/opencommit
MIT License
6.15k stars 328 forks source link

XDG config location #69

Open Poshi opened 1 year ago

Poshi commented 1 year ago

It would be good if the configuration file could be located somewhere else. In particular, it would be nice to have it located where the XDG specification states (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html), so you can have all your files under $XDG_CONFIG_HOME. It should not be a difficult change and will allow us to have a cleaner home and an easier configuration backup.

The ability of setting the config file via environment variable (like OC_CONFIG=~/.opencommit), or using an environment variable to configure the software (like OPENAI_API_KEY=MyKey) would also be welcomed.

tifandotme commented 1 year ago

+1

robellegate commented 1 year ago

Having the ability to pass the OpenAI API key via an ENV var, and not storing it in plaintext on disk, would boost my confidence in using OC.

*Edit: the ENV var feature allegedly exists per #80, although it's not well documented.

github-actions[bot] commented 1 year ago

Stale issue message

Poshi commented 1 year ago

Really? :-(

slacksystem commented 1 year ago

Having the ability to pass the OpenAI API key via an ENV var, and not storing it in plaintext on disk, would boost my confidence in using OC.

*Edit: the ENV var feature allegedly exists per #80, although it's not well documented.

Sorry to re-open, but can you tell me how the changes in $80 can be used such that the key can be stored in an environment variable instead of a file?

schroedermatthias commented 1 month ago

+1 I'd also love to see the config file being read from $XDG_CONFIG_HOME. I would suggest the implementation as follows:

  1. If present, the $XDG_CONFIG_HOME/.opencommit file is considered
  2. If not, it falls back to the currently hardcoded path ~/.opencommit
  3. exported environment variables always overrule 1. and 2.