M docs/configuration.md => docs/configuration.md +1 -0
@@ 24,5 24,6 @@ shout = false
versions it is ignored.
- Unknown keys are ignored, so you will not recieve an error for a misspelt
key. Double-check the spelling if a setting seems to have no effect.
+- If neither `$XDG_CONFIG_HOME` nor `$HOME` is set, no file is read.
See also: [installation](install.md).
M src/hello_hut/config.py => src/hello_hut/config.py +6 -1
@@ 9,7 9,12 @@ except ModuleNotFoundError: # Python < 3.11
def config_path():
- base = os.environ.get("XDG_CONFIG_HOME") or os.path.join(os.environ["HOME"], ".config")
+ base = os.environ.get("XDG_CONFIG_HOME")
+ if not base:
+ home = os.environ.get("HOME")
+ if not home:
+ return None
+ base = os.path.join(home, ".config")
return os.path.join(base, "hello-hut", "config.toml")