tilie_server.settings#

Typed settings for one server run.

tilie_server.settings.PUBLIC_BODY_LIMIT = 16777216#

The largest request body, in bytes, a server in public mode accepts.

tilie_server.settings.PUBLIC_TABLE_ROWS = 1000000#

The most rows of a posted table a server in public mode reads.

tilie_server.settings.PUBLIC_TABLE_BYTES = 134217728#

The largest posted table, in bytes uncompressed, a server in public mode reads.

tilie_server.settings.PUBLIC_COMPUTATIONS = 2#

The most posted-body computations a server in public mode runs at once.

tilie_server.settings.PUBLIC_CONNECTIONS = 32#

The most connections a server in public mode serves at once.

tilie_server.settings.size_named(size)[source]#

A number of bytes as a refusal names it.

A whole number of MiB is named in MiB, any other number in bytes, with a comma between thousands.

Parameters:

size (int)

Return type:

str

class tilie_server.settings.ServerSettings(host, port, token, static_dir=None, root=<factory>, public_hosts=(), files=True, body_limit=None, table_rows=None, table_bytes=None, computations=None, connections=None)[source]#

Bases: object

The network, authorization, static-app and file settings for one run.

A local run (the default) answers to its own loopback origin, checks the run’s bearer token on every /api/ path and serves the file routes below root. A public run names the hosts it answers as in public_hosts, checks no token, serves no files and bounds every request body, every posted table and the work done at once.

Variables:
  • host (str) – The address the server binds.

  • port (int) – The port the server listens on.

  • token (str | None) – The bearer token every /api/ path requires; None for no token check.

  • static_dir (pathlib.Path | None) – The built editor to serve; the bundled one when None.

  • root (pathlib.Path) – The folder whose files the file routes serve: the user’s home folder unless another is given.

  • public_hosts (tuple[str, ...]) – The Host header values a public run answers to, exactly as given; empty for a local run.

  • files (bool) – Whether the file routes are served; only with a token.

  • body_limit (int | None) – The largest request body in bytes; None for no limit.

  • table_rows (int | None) – The most rows of a posted table; None for no bound.

  • table_bytes (int | None) – The largest posted table in bytes uncompressed; None for no bound.

  • computations (int | None) – The most posted-body computations run at once, the others waiting their turn; None for no limit.

  • connections (int | None) – The most connections served at once, uvicorn answering 503 beyond them; None for no limit.

Parameters:
  • host (str)

  • port (int)

  • token (str | None)

  • static_dir (Path | None)

  • root (Path)

  • public_hosts (tuple[str, ...])

  • files (bool)

  • body_limit (int | None)

  • table_rows (int | None)

  • table_bytes (int | None)

  • computations (int | None)

  • connections (int | None)

host: str#
port: int#
token: str | None#
static_dir: Path | None = None#
root: Path#
public_hosts: tuple[str, ...] = ()#
files: bool = True#
body_limit: int | None = None#
table_rows: int | None = None#
table_bytes: int | None = None#
computations: int | None = None#
connections: int | None = None#
allowed_hosts()[source]#

Return the Host header values this server answers to.

Return type:

frozenset[str]

allowed_origins()[source]#

Return the Origin header values this server accepts.

A public host is reached through HTTPS in front of the server, or through HTTP on a trial run, so both schemes are accepted for it; a local run is reached through HTTP alone.

Return type:

frozenset[str]