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

Change location of klog config folder #251

Merged
merged 2 commits into from
Feb 17, 2023
Merged

Change location of klog config folder #251

merged 2 commits into from
Feb 17, 2023

Conversation

jotaen
Copy link
Owner

@jotaen jotaen commented Feb 17, 2023

Resolves #250.

The lookup order for klog’s config folder (previously referred to as “klog folder”, residing at ~/.klog by default on all OS’es) is now this:

  • macOS:
    • $KLOG_CONFIG_HOME (expects full path including the “suffix” bit, so you can also set it to be /foo/bar/all-my-klog-configs if that fancies you)
    • $XDG_CONFIG_HOME/klog (for XDG-addicts that stranded on macOS for some reason)
    • $HOME/.klog (the default / most “idiomatic” config location on macOS for CLI apps)
  • Linux:
    • $KLOG_CONFIG_HOME (see above)
    • $XDG_CONFIG_HOME/klog
    • $HOME/.config/klog (the default / most “idiomatic” config location on Linux)
  • Windows
    • %KLOG_CONFIG_HOME% (see above)
    • %AppData%\klog (the default / most “idiomatic” config location on Windows)

klog iterates through these respective locations, and the first env var that’s set wins. klog will look for (and potentially initialise) the config folder at that location.

By doing klog --config-folder, you can see which one it chose, and it also prints the lookup order for reference – e.g., on macOS:

$ klog --config-folder
/Users/jan/.klog
(Lookup order: $KLOG_CONFIG_HOME, $XDG_CONFIG_HOME/klog, $HOME/.klog)

For the env var name, I eventually settled on KLOG_CONFIG_HOME, as I find that most clear and straightforward.

@jotaen jotaen merged commit f759432 into main Feb 17, 2023
@jotaen jotaen deleted the config-home branch February 17, 2023 10:49
@jotaen jotaen mentioned this pull request Feb 17, 2023
jotaen added a commit that referenced this pull request Mar 6, 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

Successfully merging this pull request may close these issues.

Be more standards-compliant about .klog/ folder location
1 participant