Skip to content

Commit

Permalink
fix(config): wont allow bool value for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
2mal3 committed Feb 22, 2025
1 parent d2e2781 commit a551c53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion somnus/environment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from os import environ
from typing import Any

from dotenv import load_dotenv
from pydantic import BaseModel, field_validator, ValidationError
Expand All @@ -23,7 +24,10 @@ class Config(BaseModel):
DEBUG: bool = False

@field_validator("DEBUG", "MC_SERVER_START_CMD_SUDO", mode="before")
def convert_str_to_bool(cls, value: str): # noqa: N805
def convert_str_to_bool(cls, value: Any): # noqa: N805
if isinstance(value, bool):
return value

return text_is_true(value)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_logic/test_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def run_server():
MC_SERVER_START_CMD="./start.sh",
MC_SERVER_ADDRESS="25565",
DISCORD_SUPER_USER_ID="",
DEBUG="true",
DEBUG=True,
)
):
pass

0 comments on commit a551c53

Please sign in to comment.