refactoring settings

This commit is contained in:
s.mostryukov 2024-10-01 18:06:04 +03:00
parent 8fbec57acb
commit c4011f0e45
3 changed files with 9 additions and 5 deletions

View File

@ -0,0 +1,3 @@
NETADM_CONFIG__RUN__HOST = "0.0.0.0"
NETADM_CONFIG__RUN__PORT = 8080
NETADM_CONFIG__RUN__RELOAD = 1

View File

@ -15,9 +15,9 @@ STATIC_DIR = BASE_DIR / "web" / "static"
class RunConfig(BaseModel): class RunConfig(BaseModel):
host: str = "0.0.0.0" host: str
port: int = 8000 port: int
reload: bool = True reload: bool
class SwaggerConfig(BaseModel): class SwaggerConfig(BaseModel):
@ -39,7 +39,7 @@ class Settings(BaseSettings):
env_nested_delimiter="__", env_nested_delimiter="__",
env_prefix="NETADM_CONFIG__", env_prefix="NETADM_CONFIG__",
) )
run: RunConfig = RunConfig() run: RunConfig
swagger: SwaggerConfig = SwaggerConfig() swagger: SwaggerConfig = SwaggerConfig()

View File

@ -29,7 +29,8 @@ def parse_input(text: str) -> List[Dict[str, Union[int, str]]]:
def start_check( def start_check(
text: str, result_type: str = "json" text: str,
result_type: str = "json",
) -> List[Dict[str, Union[int, str, bool]]] | List[str]: ) -> List[Dict[str, Union[int, str, bool]]] | List[str]:
logging.info("") logging.info("")
result = [] result = []