mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-12 18:46:40 +07:00
Transactions can carry a `notes` field (set via the API — e.g. the currency-conversion metadata on this user's imported historical data), but there was no way to see it in the UI at all. TransactionsTable now shows a note icon next to edit/delete, only when a transaction actually has one, opening a dialog with the text. The edit form's `notes` field was already wired end to end (state, payload) but had no input in the JSX — added it, since a view-only note with no way to edit or clear it would be a dead end. Also fixed e2e/run.sh's readiness check, found while running the full suite for this change: it polled `/` (nginx, answers almost immediately) instead of `/api/health`, so the first test could start before the backend finished migrating/seeding and fail trying to parse nginx's HTML error page as JSON.
45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
"""Application configuration, sourced from environment variables (.env)."""
|
|
from functools import lru_cache
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
# Single source of truth for the running app's version — surfaced in the API
|
|
# title and embedded in exported backups so an old file can be told apart
|
|
# from a current one.
|
|
APP_VERSION = "0.20.0"
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", env_prefix="AURUM_", extra="ignore")
|
|
|
|
# Postgres connection
|
|
postgres_user: str = "aurum"
|
|
postgres_password: str = "aurum"
|
|
postgres_db: str = "aurum"
|
|
postgres_host: str = "db"
|
|
postgres_port: int = 5432
|
|
|
|
# Default currency shown across the UI when an account doesn't override it
|
|
default_currency: str = "USD"
|
|
|
|
# Comma-separated list of origins allowed to call the API (frontend dev server, etc.)
|
|
cors_origins: str = "*"
|
|
|
|
@property
|
|
def database_url(self) -> str:
|
|
return (
|
|
f"postgresql+asyncpg://{self.postgres_user}:{self.postgres_password}"
|
|
f"@{self.postgres_host}:{self.postgres_port}/{self.postgres_db}"
|
|
)
|
|
|
|
@property
|
|
def cors_origins_list(self) -> list[str]:
|
|
if self.cors_origins == "*":
|
|
return ["*"]
|
|
return [origin.strip() for origin in self.cors_origins.split(",") if origin.strip()]
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|