Skip to main content

Module env

Module env 

Source
Expand description

The environment surface a node reads at start-up (blueprint §24.2).

Everything here is read, never written: a node inspects its environment once, during init, and from then on the values live in typed fields. The module exists so that the set of variables AstRS reads is enumerable in one place — astrs doctor (§17) prints exactly this table.

VariableRead byDefault
ASTRS_NODE_CONFIGcrate::Node::init_from_env— (required)
ASTRS_RUN_PARENT_PIDthe orphan guard (§4.2)no guard
ASTRS_DAEMON_PORTdynamic attach (§8.3)7408
ASTRS_RUNTIME_DIRdynamic attach$XDG_RUNTIME_DIR/astrs
ASTRS_ZERO_COPY_THRESHOLDthe send path (§6.2)4096
ASTRS_TYPE_CHECKtyped handles (§9.2)warn

§Examples

use astrs_node_api::env::TypeCheckMode;

assert_eq!("warn".parse(), Ok(TypeCheckMode::Warn));
assert!(TypeCheckMode::Error.is_fatal());
assert!(!TypeCheckMode::default().is_fatal(), "0.1.0 defaults to warn");

Enums§

TypeCheckMode
How strictly a typed handle checks a port’s declared URN (§9.2).

Constants§

DAEMON_SOCKET_NAME
The daemon’s Unix-domain socket name inside the runtime directory (§4.2).
DEFAULT_DAEMON_PORT
The daemon’s loopback node port (§24.2).
ENV_DAEMON_PORT
The environment variable overriding the daemon’s loopback node port.
ENV_RUNTIME_DIR
The environment variable overriding the runtime directory.
ENV_TYPE_CHECK
The environment variable selecting the runtime type-check mode (§9.2).
ENV_XDG_RUNTIME_DIR
The freedesktop variable the default runtime directory is derived from.
ENV_ZERO_COPY_THRESHOLD
The environment variable overriding the zero-copy threshold.
READ_VARIABLES
Every environment variable this crate reads, in documentation order.
RUNTIME_DIR_LEAF
The runtime directory leaf appended to $XDG_RUNTIME_DIR.
SHM_BROKER_SOCKET_NAME
The shared-memory broker socket name inside the runtime directory (§6.2).

Functions§

daemon_port
Reads ASTRS_DAEMON_PORT, defaulting to DEFAULT_DAEMON_PORT.
daemon_socket_path
The daemon’s Unix-domain socket path under runtime_dir.
parent_pid
Reads ASTRS_RUN_PARENT_PID, when it is set (§4.2).
runtime_dir
The runtime directory for this process (§24.2).
shm_broker_path
The shared-memory broker socket path under runtime_dir.
zero_copy_threshold
Reads ASTRS_ZERO_COPY_THRESHOLD, defaulting to the §24.2 4 KiB.