Skip to main content

Module config

Module config 

Source
Expand description

The one configuration file a running supervisor reads, and its validation.

§Every field this program takes is declared once, here

ConfigField is that declaration: one variant per configured value, each carrying the dotted key it is spelled under. Two things read it rather than restating it — the refusal a bad value produces names its field through it, and this crate’s own tier walks it, driving a server against a configuration in which each field in turn is unacceptable. A field added to the shapes below and not to ConfigField::ALL fails that tier’s own coverage check, so the walk cannot fall behind the type.

§Validation happens at startup, and names the field

A value that cannot work is refused where it is configured rather than at the first request that needs it, and the refusal carries the field’s own key so an operator editing the file knows which line to change. That includes the two values only the machine can rule on: an OctoPrint address nothing answers at and a key that instance refuses are both configuration mistakes, and crate::Server::start refuses them naming ConfigField::OctoprintUrl and ConfigField::OctoprintApiKey.

§The ingress answer bound

Obico’s webhook notification plugin posts best-effort with a short timeout and does not retry, so this server answers its ingress before the handling completes and inside a bound it declares here. The shipped default is DEFAULT_INGRESS_ANSWER_BOUND_MS and the timeout it must stay below is OBICO_POSTING_TIMEOUT_MS; AGENTS.md’s “The Obico ingress answer bound” records that number, where it was read and why the default is where it is, and just check-repo refuses a tree in which the two disagree.

§The operator’s credential, by its verifier

Every request beneath the versioned prefix carries one credential. The operator’s is checked against a CredentialVerifier — the SHA-256 of the credential, written sha256:<64 lowercase hex> — which api.credential_verifier names, so the server holds nothing a supervision turn reading its files could authenticate with. The plaintext lives with the operator, in the client configuration printobserver credential issue writes.

api.credential, a plaintext credential, is still read for an installation that wrote one, and admitted until it is replaced; the composition root warns on every start that it is there. Either way a credential is held in a type neither rendering of which shows it, and is compared in constant time.

§The periodic observation

supervisor.observation_interval_s is how often every active print is given a periodic observation and its agent a turn on it, whether or not the detector has alerted. Left out it is DEFAULT_OBSERVATION_INTERVAL_S — two minutes — and zero is refused, because an interval of nothing is a turn started the moment the last one returns.

§The camera and Obico’s own API

Both are optional. camera.snapshot_url is where a look fetches a fresh frame; without it a look carries the printer’s state and no frame. obico.url and obico.access_token are given together or not at all: they are how a print the detector paused and the agent adjusted is acknowledged to Obico, which re-arms its detection. Each address must be an http or https URL, and the token is held in a type whose debug form never shows it, so no refusal or log line this program writes can carry it.

§The spool check

[spools] is optional, and so is every key in it: preflight is what a start does when the loaded spool is short, unverified or the file has no analysis — refuse, warn or off — buffer_percent and buffer_min_g the margin asked beyond what a print needs, and analysis_wait_seconds how long a start waits for OctoPrint’s analysis of a file that has none yet. Each left out takes the supervision core’s own default, and a negative figure or a mode outside the three is refused naming its key.

Structs§

ApiCredential
One credential in plaintext: a legacy api.credential, the legacy file a server generated into its state directory, or one printobserver credential issue draws for the operator’s own configuration.
ApiSection
What a caller of the versioned API authenticates with, as written down.
CameraSection
Where a fresh frame of the print is fetched from, as written down.
ConfigFile
The whole configuration file, exactly as it is written down.
CredentialVerifier
What one operator credential is checked against: the SHA-256 of its UTF-8 bytes.
IngressSection
What the Obico ingress requires and how fast it answers, as written down.
ObicoSection
Where Obico’s own API answers, as written down.
OctoprintSection
Where the OctoPrint instance is and what it is like, as written down.
ServerConfig
One running server’s validated configuration.
SharedSecret
The shared secret the ingress requires of every post.
SignInConfig
The two values signing a harness in reads, and nothing else.
SpoolsSection
How spools are checked before a print, as written down.
SupervisorSection
How the supervising agent is reached, as written down.

Enums§

ConfigError
Why this server will not start under the configuration it was given.
ConfigField
Every value this program is configured with, and the key it is spelled under.

Constants§

ASSETS_DIRECTORY
The directory under the state directory this server materializes the supervising agent’s prompt template and assessment schema into. The skill is not among them: it is installed with SKILL_INSTALL and configured by supervisor.skill_path.
DEFAULT_INGRESS_ANSWER_BOUND_MS
The answer bound this repository ships, in milliseconds.
DEFAULT_OBSERVATION_INTERVAL_S
How often every active print is observed, in seconds, when the configuration names no interval: the core’s own default.
FAN_VOCABULARY
The vocabulary OctoprintSection::fan takes, spelled as the operator writes it.
GENERATED_CREDENTIAL_BYTES
How many random bytes a credential this server generates is drawn from.
OBICO_POSTING_TIMEOUT_MS
The timeout Obico’s own webhook notification plugin posts under.
REDACTED
What a secret renders as, wherever a value carrying one is rendered.
SKILL_INSTALL
How the supervising agent’s skill is installed, and what names it after.
VERIFIER_PREFIX
What a credential verifier is written with before its digest.

Functions§

plainly_written
A resolved path, written the way its own platform’s tools write it.