Skip to main content
See Global configuration for file fields and defaults, and Runtime setup for installation.

GlobalConfigPatch

load()

Read saved user settings while preserving omitted fields and explicit clears. A missing file returns an empty patch. Defaults and managed overrides are applied later.

save()

Save the patch without filling in defaults. Omitted fields stay omitted and explicit clears are preserved. Unknown user fields are ignored on load and discarded on save.

GlobalConfig

Resolved settings after layering. Use LocalContext::config() to read the effective configuration for a backend.

LocalContext

config()

Read the settings retained by this backend. Existing handles keep their configuration when files or process defaults change.

Runtime paths

Inspect the active config and resolve runtime paths with the same precedence used by sandbox startup:
When your code owns an explicit local backend, prefer the backend-owned config:
LocalContext has two plain constructors alongside the builder. LocalContext::lazy()? is synchronous and defers opening (and migrating) the local sandbox database until the first operation; it is what backend resolution uses when no backend is set explicitly. LocalContext::new().await? opens the database up front, so startup fails fast if the database is unusable. All constructors read, layer, and validate global configuration before returning a backend; only database setup is lazy. Proxy settings are validated after sandbox options and managed overrides are composed, before network use. LocalContextBuilder::build() now returns Result<LocalContext>. It replaces try_build(), and LocalContext no longer implements Default; use LocalContext::lazy()? instead. For a long-lived process, construct a new context to pick up configuration changes. Bind subsequent work with Sandbox::ctx(&context) or the context’s collections. Existing collections, builders and resources retain their original destination and settings.

LocalContextBuilder

config_path()

Read a specific user configuration file without changing MSB_CONFIG_PATH. Managed settings still apply. The builder’s home() selects data storage; it does not select the configuration file. Backend-selection helpers and synchronous constructors remain synchronous.

deployment_profile()

Set the deployment profile for this backend. It takes precedence over the user configuration file and each sandbox’s requested profile on create and restart. Managed settings retain precedence. See deployment profiles for behavior.

ssh_inactivity_timeout_secs()

Override the user-configured SSH inactivity timeout. Zero disables it; managed settings retain precedence. See SSH settings for when the value is captured.

Sandbox configuration patches

Use SandboxBuilder::overlay() to override individual settings or explicitly clear an inherited working directory. These choices survive SandboxBuilder::from(config) and local database reloads. Without saved caller overrides, workdir: None still means omitted. Edit settings through builder setters, overlay(), or sandbox modification APIs; saved overrides can overwrite direct edits to a resolved SandboxConfig. See configuration layering for precedence and backend differences.

Context

sandboxes(), volumes(), snapshots()

Choose which connection resource builders use. These accessors perform no backend I/O. Collections and builders keep using that connection even after the original variable goes out of scope. Use the default resource builders for local execution, or choose a context for remote execution or custom local settings.

clone_shared()

Clone the context while sharing its connection and settings. LocalContext clones share configuration, database initialization and control state. RemoteContext clones share their HTTP client and captured configuration. Context binding accepts &dyn Context; callers do not need to allocate an Arc themselves.

Resource and builder context()

Sandbox, Volume, Snapshot and their builders expose their connection through this synchronous accessor. It returns the existing connection without allocating or contacting the backend. Use it to select another collection on the same destination.

RemoteContext

new() / with_url()

new(api_key) uses MSB_API_URL or the hosted endpoint. Use with_url(url, api_key) to specify both.

builder()

Configure a remote endpoint, credentials and transport options. The builder’s synchronous build() validates and captures its settings. Resource requests happen through its collections or Resource::ctx(&context).

to_builder()

Return a builder initialized from captured endpoint, credentials, compute type, transport options and configuration. Building creates an independent context without rereading profiles, environment or configuration files. Existing resources retain their original context. A supplied custom HTTP client keeps its transport settings; the context API key controls Authorization. See derivation examples.

RemoteContextBuilder

compute_type()

Choose Standard or Shared for new sandboxes and snapshot restores. Omission uses the server default. Existing sandboxes keep their type. See compute types.