Skip to main content

Module config

Module config 

Source
Expand description

Configuration: defaults, XDG TOML, CLI override (no product env knobs).

Split for SRP: constants, validate, load (paths + TOML + Config).

Re-exports§

pub use crate::domain::is_stdlib_name as is_stdlib_crate;

Structs§

Config
Runtime configuration resolved from defaults, XDG TOML, and CLI flags.
ConfigInitResult
Result of config init.
ConfigPathData
Path inventory for config path (agent-readable).

Enums§

PathSource
Which layer won when resolving a storage path (XDG hierarchy diagnostics).

Constants§

APP_NAME
Product binary / crate name.
APP_VERSION
Package version from Cargo.
CANCEL_POLL_INTERVAL_MS
Cancel-aware sleep / flock poll step (milliseconds).
CONFIG_FILE_NAME
File name of the optional XDG configuration file.
DEFAULT_CACHE_TTL_SECS
Default HTTP disk cache TTL (seconds).
DEFAULT_CONNECT_TIMEOUT_SECS
Default TCP connect timeout (seconds).
DEFAULT_CONTACT_URL
Default contact / repository URL (from Cargo.toml [package].repository).
DEFAULT_LOG_DIRECTIVE
Default tracing filter when neither -q / -v nor log_directive apply.
DEFAULT_MAX_BODY_BYTES
Default maximum downloaded response body size (bytes).
DEFAULT_MAX_CACHE_BYTES
Default HTTP disk cache budget in bytes (256 MiB). 0 = unlimited.
DEFAULT_MAX_OUTPUT_BYTES
Default maximum emitted stdout payload size (bytes).
DEFAULT_MAX_REDIRECTS
Default maximum HTTP redirects followed.
DEFAULT_MAX_RETRIES
Default maximum retries for transient HTTP errors.
DEFAULT_PER_PAGE
Default per_page for crates.io search.
DEFAULT_RATE_LIMIT_DELAY_MS
Default minimum delay between requests to the same host (milliseconds).
DEFAULT_RETRY_BASE_MS
Base backoff delay (milliseconds) for retries.
DEFAULT_RETRY_MAX_DELAY_MS
Default ceiling for a single retry sleep (milliseconds).
DEFAULT_RETRY_MAX_ELAPSED_MS
Default total retry wall budget (0 = derive from timeout_secs).
DEFAULT_SEARCH_LIMIT
Default hit limit for search-in-crate.
DEFAULT_TIMEOUT_SECS
Default wall-clock timeout (seconds) for one operation.
HARD_MAX_BODY_BYTES
Hard ceiling for HTTP body size (CLI / TOML cannot raise above this).
HARD_MAX_CONNECT_TIMEOUT_SECS
Hard ceiling for TCP connect timeout (seconds).
HARD_MAX_OUTPUT_BYTES
Hard ceiling for emitted stdout payload size (CLI / TOML cannot raise above).
HARD_MAX_RATE_LIMIT_DELAY_MS
Hard ceiling for per-host politeness delay (milliseconds).
HARD_MAX_REDIRECTS
Hard ceiling for HTTP redirects (CLI / TOML cannot raise above this).
HARD_MAX_TIMEOUT_SECS
Hard ceiling for wall-clock timeout (seconds).
HOST_CRATES_IO
crates.io host allowlist entry.
HOST_DOCS_RS
docs.rs host allowlist entry.
HOST_DOC_RUST_LANG_ORG
Official stdlib rustdoc host (std / core / alloc).
HOST_LOCALHOST
Loopback hostname (offline mocks when allow_loopback is true).
HOST_LOOPBACK_IPV4
Loopback IPv4 host (offline mocks when allow_loopback is true).
HOST_STATIC_DOCS_RS
static.docs.rs host allowlist entry (redirects).
HTTPS_PORT
TLS port used by the doctor --online DNS/TCP reachability probe.
MAX_CONFIG_TOML_BYTES
Hard ceiling for on-disk config.toml size (poisoned-config guard).
MAX_CRATE_DESCRIPTION_CHARS
Maximum crate description length when mapping crates.io JSON → agent payload.
MAX_CRATE_NAME_CHARS
Maximum crate name length.
MAX_ITEM_PATH_CHARS
Maximum rustdoc item path length.
MAX_PER_PAGE
Maximum per_page accepted for crates.io search.
MAX_QUERY_CHARS
Maximum query string length.
MAX_SEARCH_IN_CRATE_LIMIT
Maximum hit limit for search-in-crate.
MAX_URL_FIELD_CHARS
Maximum length for optional URL / page-token fields from crates.io JSON (documentation, repository, homepage, next_page, prev_page).
MAX_USER_AGENT_CHARS
Maximum User-Agent length.
MAX_VERSION_CHARS
Maximum version string length.
MSRV
Minimum supported Rust version.
PLACEHOLDER_CONTACT_HOST
Historical placeholder contact host that doctor must reject.
PROGRESS_HINT_DELAY_SECS
Delay before printing a progress hint on slow network ops (seconds).
SCHEMA_VERSION
JSON envelope schema_version constant.
SCHEME_HTTPS
HTTPS scheme token (product endpoints are TLS-only in production).

Functions§

config_path_data
Build path inventory from a loaded Config.
config_toml_under
Ensure path is under a directory (used by tests / path display).
default_config_toml
Default config.toml body written by config init (commented template).
default_user_agent
Builds the default User-Agent, optionally including a contact token.
docs_origin_for_crate
Resolve docs origin for a crate: stdlib → doc.rust-lang.org, else configured docs.rs origin.
init_config_toml
Create default config.toml under the resolved config directory.
is_allowed_origin_scheme_host
True when scheme+host is a legal origin for product config (defense in depth).
is_allowlisted_host
True when host is a product HTTP allowlist entry (SSRF gate).
normalize_origin
Strip trailing slash from an origin base URL.
resolve_config_dir
Resolve config directory: CLI override, then XDG.
resolve_config_dir_with_source
Resolve config directory and report which layer won.
validate_contact
Validate optional contact token embedded into the default User-Agent.
validate_origin
Parse an allowlisted origin (compat wrapper over AllowedOrigin::parse).
validate_origin_with
Parse an origin with an explicit loopback policy (CLI/XDG allow_loopback).
validate_user_agent
Validate User-Agent: non-empty, length-capped, visible ASCII only (HTTP header).