Skip to content

qmd_py.config

Application settings, loaded from MARQ_* environment variables or a .env file — see Configuration for the user-facing reference.

config

Application settings, loaded from environment / .env.

qmd-py lives in its own qmd_py Postgres schema inside the same qmd database the TS/Postgres reference implementation uses (not a separate database - see the project plan's "Single Postgres, forever" decision). Isolation from the TS tables (which live in public) comes from the search_path connection option below, not from a different database.

Settings

Bases: BaseSettings

Application settings, read from MARQ_* env vars or a .env file.

Constructing this raises pydantic.ValidationError when a required setting is missing - cli/main.py catches that at the outermost level and turns it into a short message rather than a traceback.

postgres_url instance-attribute

postgres_url: str

postgresql+psycopg://user:pass@host/db - no search_path needed here, it's appended automatically in sqlalchemy_url.

llm_base_url class-attribute instance-attribute

llm_base_url: str = 'http://localhost:8099'

A localhost placeholder, not a real router. Deliberately not a required setting: the LLM is only needed by query/vsearch/embed/doctor, and making it required would stop status/ls/get/search working for someone with no router at all. Pointing at localhost means an unconfigured install fails with an obvious connection-refused on its own machine, rather than a confusing timeout against a host that only exists on this project author's network - see llm-stack/README.md to run one locally.

default_user_email class-attribute instance-attribute

default_user_email: str = 'local@marq.local'

Identifies the single mocked user (see auth.py). Created on first use.

log_level class-attribute instance-attribute

log_level: str = 'WARNING'

DEBUG/INFO/WARNING/ERROR/CRITICAL. The default is silent on a healthy run - a non-empty log means something actually degraded (see log.py). INFO is the sensible level for a long-running MCP daemon; the CLI's -v/-vv flags override this per invocation.

log_file class-attribute instance-attribute

log_file: Path | None = None

Log to this size-rotated file instead of stderr. Unset means stderr, which is what the CLI and the stdio MCP transport want - never stdout, which carries parseable output and JSON-RPC respectively.

sqlalchemy_url property

sqlalchemy_url: str

postgres_url with the schema pinned via a libpq options parameter.

Returns:

  • str

    The DSN with search_path appended, joined with ? or &

  • str

    depending on whether the configured URL already carries a

  • str

    query string.

get_settings cached

get_settings() -> Settings

Lazily constructed so importing this module doesn't require MARQ_POSTGRES_URL to already be set (e.g. during test collection).

Source code in src/qmd_py/config.py
@lru_cache
def get_settings() -> Settings:
    """Lazily constructed so importing this module doesn't require
    MARQ_POSTGRES_URL to already be set (e.g. during test collection)."""
    return Settings()  # postgres_url comes from env