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 directory standard #336

Open
sagikazarmark opened this issue Jan 7, 2021 · 9 comments
Open

Support XDG directory standard #336

sagikazarmark opened this issue Jan 7, 2021 · 9 comments

Comments

@sagikazarmark
Copy link
Member

sagikazarmark commented Jan 7, 2021

Is your feature request related to a problem? Please describe.
Cool kids keep their home directories clean.

Describe the solution you'd like to see
Support loading configuration from $XDG_CONFIG_HOME.

Describe alternatives you've considered
This is the way. No alternatives.

Additional context
Should probably wait for spf13/viper#1048

@orymate
Copy link
Contributor

orymate commented Jan 7, 2021

  • "If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used."
  • Load config from $BANZAICONFIG file, or from the first directory existing of
    • (maybe $BANZAI_CONFIG_HOME)
    • $XDG_CONFIG_HOME/banzai
    • $HOME/.banzai
  • Create new config dir in $XDG_CONFIG_HOME

@sagikazarmark
Copy link
Member Author

The correct (detailed) order is:

  • BANZAI_CONFIG_HOME (if we want to support it)
  • $XDG_CONFIG_HOME/banzai
  • $HOME/.config/banzai (new default, fallback if $XDG_CONFIG_HOME is not defined)
  • $HOME/.banzai (for backward compatibility)

@orymate
Copy link
Contributor

orymate commented Jan 7, 2021

I would stick to using $HOME/.config/banzai only if XDG_CONFIG_HOME is not set.

@sagikazarmark
Copy link
Member Author

That's exactly what the above means. (And that's why I emphasized the order)

@orymate
Copy link
Contributor

orymate commented Jan 7, 2021

That's exactly what the above means. (And that's why I emphasized the order)

Not really. We shouldn't check $HOME/.config/banzai if a different XDG_CONFIG_HOME is set, but there is no banzai config there.

@sagikazarmark
Copy link
Member Author

Why not?

@orymate
Copy link
Contributor

orymate commented Jan 8, 2021

Why not?

Because the referenced xdg standard defines it this way.

@sagikazarmark
Copy link
Member Author

No. It only says what should be the fallback if the relevant env var is not defined. Nothing says we can't use it otherwise.

But determining a location for writing a config for the first time is tricky (even without this search entry)

@orymate
Copy link
Contributor

orymate commented Jan 8, 2021

No. It only says what should be the fallback if the relevant env var is not defined. Nothing says we can't use it otherwise.

Yes, and that's the only difference between the two lists in the first two comments on this issue...

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