21 lines
494 B
Python
21 lines
494 B
Python
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class AppSettings(BaseSettings):
|
|
config_dir: Path = Path("./config")
|
|
database_url: str | None = None
|
|
|
|
model_config = SettingsConfigDict(env_prefix="MKVTOOL_", env_file=".env")
|
|
|
|
@property
|
|
def resolved_database_url(self) -> str:
|
|
if self.database_url:
|
|
return self.database_url
|
|
return f"sqlite:///{self.config_dir / 'mkvtool.db'}"
|
|
|
|
|
|
settings = AppSettings()
|
|
|