name collision

This commit is contained in:
Jörn-Michael Miehe 2022-03-16 00:59:33 +00:00
parent 663196c493
commit 162d1729d1
2 changed files with 4 additions and 5 deletions

View file

@ -70,6 +70,6 @@ async def is_configured() -> bool:
return Path(CONFIG_FILE).is_file() return Path(CONFIG_FILE).is_file()
async def get_config() -> BaseConfig: async def get_current_config() -> BaseConfig:
with open(CONFIG_FILE, "r") as kv: with open(CONFIG_FILE, "r") as kv:
return BaseConfig.parse_obj(json.load(kv)) return BaseConfig.parse_obj(json.load(kv))

View file

@ -3,8 +3,8 @@ from secrets import token_hex
from fastapi import APIRouter, Depends, status from fastapi import APIRouter, Depends, status
from fastapi.responses import JSONResponse from fastapi.responses import JSONResponse
from ..config import (CONFIG_FILE, CRYPT_CONTEXT, DB, BaseConfig, get_config, from ..config import (CONFIG_FILE, CRYPT_CONTEXT, DB, BaseConfig,
get_default_config, is_configured) get_current_config, get_default_config, is_configured)
from ..db import Certificate, DistinguishedName, User, UserCapability from ..db import Certificate, DistinguishedName, User, UserCapability
router = APIRouter(prefix="/install") router = APIRouter(prefix="/install")
@ -27,12 +27,11 @@ async def get_default_config(config: BaseConfig = Depends(get_default_config)):
) )
async def get_config( async def get_config(
is_configured: bool = Depends(is_configured), is_configured: bool = Depends(is_configured),
config: BaseConfig = Depends(get_config),
): ):
if not is_configured: if not is_configured:
return JSONResponse(status_code=status.HTTP_404_NOT_FOUND) return JSONResponse(status_code=status.HTTP_404_NOT_FOUND)
return config return await get_current_config()
@router.put( @router.put(