Skip to content

Settings

settings

get_settings() cached

Return the cached Settings instance (memoized via lru_cache).

Source code in xplan_tools/settings/settings.py
@lru_cache
def get_settings() -> Settings:
    """Return the cached `Settings` instance (memoized via ``lru_cache``)."""
    return Settings()

Settings

Bases: BaseSettings

Runtime configuration for database access and schema creation.

Values are read from environment variables prefixed with xmas_ (e.g. db_srid is set via XMAS_DB_SRID) or from a .env file; unknown variables are ignored.

Attributes:

Name Type Description
db_srid int

EPSG SRID of the geometry columns created in the database.

db_schema str | None

PostgreSQL schema to place the tables in; None uses the default (public) namespace.

db_views bool

Whether to create per-geometry-type views alongside the tables.

db_insert_batch_size int

Features per statement when bulk-writing. On PostgreSQL every column travels as one array parameter, so this only bounds the payload of a single protocol message; other dialects bind one parameter per cell and are clamped to stay under their host-parameter limit.

db_pool_size int

SQLAlchemy connection-pool size for PostgreSQL engines.

db_pool_max_overflow int

Connections allowed beyond db_pool_size.

db_pool_timeout int

Seconds to wait for a pooled connection before erroring.

db_pool_recycle int

Seconds after which a pooled connection is recycled.

db_pool_pre_ping bool

Whether to liveness-check pooled connections before use.

ds_allow_remote bool

Whether an http(s) datasource may be retrieved. Off by default: a service that forwards a request-supplied datasource would otherwise be able to reach hosts on its own network.

ds_remote_timeout float

Seconds to wait on a remote datasource before erroring. A WFS GetFeature response can take a while to assemble.

ds_remote_max_bytes int

Largest remote response body accepted. A remote body is unbounded in a way a local file is not.