diff --git a/PFERD/auth/__init__.py b/PFERD/auth/__init__.py index 06b3ba4..277cade 100644 --- a/PFERD/auth/__init__.py +++ b/PFERD/auth/__init__.py @@ -16,7 +16,7 @@ AuthConstructor = Callable[[ AUTHENTICATORS: Dict[str, AuthConstructor] = { "credential-file": lambda n, s, c: - CredentialFileAuthenticator(n, CredentialFileAuthSection(s)), + CredentialFileAuthenticator(n, CredentialFileAuthSection(s), c), "keyring": lambda n, s, c: KeyringAuthenticator(n, KeyringAuthSection(s)), "simple": lambda n, s, c: diff --git a/PFERD/auth/credential_file.py b/PFERD/auth/credential_file.py index 540b65b..30a56ba 100644 --- a/PFERD/auth/credential_file.py +++ b/PFERD/auth/credential_file.py @@ -1,6 +1,7 @@ from pathlib import Path from typing import Tuple +from ..config import Config from ..utils import fmt_real_path from .authenticator import Authenticator, AuthLoadError, AuthSection @@ -14,10 +15,10 @@ class CredentialFileAuthSection(AuthSection): class CredentialFileAuthenticator(Authenticator): - def __init__(self, name: str, section: CredentialFileAuthSection) -> None: + def __init__(self, name: str, section: CredentialFileAuthSection, config: Config) -> None: super().__init__(name) - path = section.path() + path = config.default_section.working_dir() / section.path() try: with open(path) as f: lines = list(f) diff --git a/PFERD/config.py b/PFERD/config.py index 1462d82..0ea7abc 100644 --- a/PFERD/config.py +++ b/PFERD/config.py @@ -69,6 +69,7 @@ class Section: class DefaultSection(Section): def working_dir(self) -> Path: + # TODO Change to working dir instead of manually prepending it to paths pathstr = self.s.get("working_dir", ".") return Path(pathstr).expanduser()