Don't allow .enroll.ini in CWD, rely on env var or XDG path
This commit is contained in:
parent
6ee8c60e64
commit
a85e8265f4
3 changed files with 10 additions and 13 deletions
|
|
@ -39,8 +39,10 @@ def _discover_config_path(argv: list[str]) -> Optional[Path]:
|
|||
1) --no-config disables loading.
|
||||
2) --config PATH (or -c PATH)
|
||||
3) $ENROLL_CONFIG
|
||||
4) ./enroll.ini, ./.enroll.ini
|
||||
5) $XDG_CONFIG_HOME/enroll/enroll.ini (or ~/.config/enroll/enroll.ini)
|
||||
4) $XDG_CONFIG_HOME/enroll/enroll.ini (or ~/.config/enroll/enroll.ini)
|
||||
|
||||
Current-directory config files are deliberately not auto-loaded; use
|
||||
--config ./enroll.ini if that behaviour is desired.
|
||||
|
||||
The config file is optional; if no file is found, returns None.
|
||||
"""
|
||||
|
|
@ -66,12 +68,6 @@ def _discover_config_path(argv: list[str]) -> Optional[Path]:
|
|||
if envp:
|
||||
return Path(envp).expanduser()
|
||||
|
||||
cwd = Path.cwd()
|
||||
for name in ("enroll.ini", ".enroll.ini"):
|
||||
cp = cwd / name
|
||||
if cp.exists() and cp.is_file():
|
||||
return cp
|
||||
|
||||
xdg = os.environ.get("XDG_CONFIG_HOME")
|
||||
if xdg:
|
||||
base = Path(xdg).expanduser()
|
||||
|
|
|
|||
Reference in a new issue