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

Explain config loading behavior in help text #540

Open
erdii opened this issue Aug 22, 2023 · 0 comments
Open

Explain config loading behavior in help text #540

erdii opened this issue Aug 22, 2023 · 0 comments

Comments

@erdii
Copy link

erdii commented Aug 22, 2023

Hey :)

I was confused by how ocm-cli selects its config files (and documents other behavior) and dug around a little :

How ocm-cli selects a config file path

Because config.Location() initially defaults to ~/.ocm.json but then stats the file to see if it exists and when it does not, the location is then actually defaulted to ~/.config/ocm/ocm.json (or wherever the user config folder on your system lives).

The config location is selected in this order:

  • checking $OCM_CONFIG. If not empty it will be the config location.
  • checking ~/.ocm.json. If a file exists there it will the the config location.
  • falling back to $XDG_CONFIG_HOME/ocm/ocm.json (XDG_CONFIG_HOME is ~/.config by default)

I think the description for ocm config should be updated to properly reflect this behavior.
ocm config --help currently states

The location of the configuration file is gleaned from the 'OCM_CONFIG' environment variable,
or ~/.ocm.json if that variable is unset. Currently using: /home/erdii/.config/ocm/ocm.json

Which is not the complete truth.

@erdii erdii changed the title config loading behavior Explain config loading behavior in help text Aug 22, 2023
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

1 participant