changed config hierarchy

This commit is contained in:
Devaev Maxim
2019-09-11 19:11:19 +03:00
parent e17889ba42
commit 2535892723
13 changed files with 46 additions and 54 deletions

View File

@@ -57,7 +57,7 @@ def _htpasswd_fixture(request) -> Generator[passlib.apache.HtpasswdFile, None, N
def _run_htpasswd(cmd: List[str], htpasswd_path: str, internal_type: str="htpasswd") -> None:
cmd = ["kvmd-htpasswd", *cmd, "--set-options"]
if internal_type != "htpasswd": # By default
cmd.append("kvmd/auth/internal_type=" + internal_type)
cmd.append("kvmd/auth/internal/type=" + internal_type)
if htpasswd_path:
cmd.append("kvmd/auth/internal/file=" + htpasswd_path)
main(cmd)

View File

@@ -50,7 +50,7 @@ def _make_service_kwargs(path: str) -> Dict:
async def _get_configured_manager(
internal_path: str,
external_path: str="",
internal_users: Optional[List[str]]=None,
force_internal_users: Optional[List[str]]=None,
) -> AsyncGenerator[AuthManager, None]:
manager = AuthManager(
@@ -58,7 +58,7 @@ async def _get_configured_manager(
internal_kwargs=_make_service_kwargs(internal_path),
external_type=("htpasswd" if external_path else ""),
external_kwargs=(_make_service_kwargs(external_path) if external_path else {}),
internal_users=(internal_users or []),
force_internal_users=(force_internal_users or []),
)
try: