Skip to content

Commit

Permalink
ignore extra settings
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz committed Jan 15, 2025
1 parent 370dd84 commit 2419d05
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/marvin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Settings(BaseSettings):
case_sensitive=False,
env_file=".env",
env_file_encoding="utf-8",
extra="forbid",
extra="ignore",
validate_assignment=True,
)

Expand All @@ -48,18 +48,13 @@ def validate_home_path(cls, v: Path) -> Path:
@model_validator(mode="after")
def validate_database_path(self) -> Self:
"""Set and validate the database path."""
# Set default if not provided
if self.database_path is None:
self.__dict__["database_path"] = self.home_path / "marvin.db"
self.database_path = self.home_path / "marvin.db"
else:
if not self.database_path.is_absolute():
self.database_path = Path.cwd() / self.database_path

# Convert to Path if string
self.__dict__["database_path"] = Path(self.database_path)

# Expand user and resolve to absolute path
self.__dict__["database_path"] = self.database_path.expanduser().resolve()

# Ensure parent directory exists
self.__dict__["database_path"].parent.mkdir(parents=True, exist_ok=True)
self.database_path.parent.mkdir(parents=True, exist_ok=True)

return self

Expand Down

0 comments on commit 2419d05

Please sign in to comment.