#[non_exhaustive]pub struct Config {Show 20 fields
pub host: String,
pub namespaces: Vec<String>,
pub budget: Duration,
pub pool_size: usize,
pub batch_max: usize,
pub slice_page: usize,
pub slice_max: usize,
pub explain_depth: usize,
pub max_jobs: usize,
pub rate: RateLimits,
pub ttl: Ttls,
pub trust_proxy: bool,
pub cross_mesh: bool,
pub cross_mesh_hosts: Option<Vec<String>>,
pub peers: BTreeMap<String, String>,
pub peer_timeout: Duration,
pub aliases: BTreeMap<String, String>,
pub policy: Policy,
pub catalog: BTreeMap<String, String>,
pub api_keys: ApiKeys,
}Expand description
The mesh’s configuration.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.host: StringThe DNS name the mesh signs as (computed_by) and serves on: https://<host>/...
(e.g. mesh-test.datumesh.com).
namespaces: Vec<String>The hosts whose names this mesh owns (default: host). A name under any other host
is resolved across meshes.
budget: DurationThe wall-clock budget of a request before it is answered pending (default 1 s).
pool_size: usizeThe blocking pool’s size: the concurrency limit (default 32).
batch_max: usizeThe most cells in one POST /cells (default 1,000).
slice_page: usizeThe default JSON page of GET /slice (default 1,000; at most 10,000 with limit=).
slice_max: usizeThe most members one slice read serves (default 1,048,576).
explain_depth: usizeThe depth of GET /explain by default (default 4; at most 16 with depth=).
max_jobs: usizeThe most jobs held at once, running or done (default 10,000).
rate: RateLimitsRate limits.
ttl: TtlsCache lifetimes.
trust_proxy: boolTake the client IP from the last X-Forwarded-For entry (behind Caddy) instead of
the peer address (default false).
cross_mesh: boolResolve names under hosts this mesh does not own (default true).
cross_mesh_hosts: Option<Vec<String>>When set, the only other hosts whose names are resolved across meshes; names under
any other host are not served (not_covered). Default: every host.
peers: BTreeMap<String, String>Origins to use instead of https://<host> for some hosts, e.g. mesh-b.example ->
http://127.0.0.1:8081 (tests and private networks only; the default is none).
peer_timeout: DurationThe time limit of one request to another mesh (default 10 s; SPEC 9.3’s bound).
aliases: BTreeMap<String, String>Short names of the call syntax: @alias -> fully qualified name.
policy: PolicyLicence and payment rules.
catalog: BTreeMap<String, String>Descriptions of the functions GET /find searches (name -> description).
api_keys: ApiKeysAPI keys (Authorization: Bearer dm_...).
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Config, ConfigError>
pub fn from_env() -> Result<Config, ConfigError>
The configuration from the environment (DATUMESH_*; the README lists them). The
files named (DATUMESH_API_KEYS_FILE, and the others) are read here; the API keys
file must have mode 0600.
Sourcepub fn from_vars(
get: impl Fn(&str) -> Option<String>,
) -> Result<Config, ConfigError>
pub fn from_vars( get: impl Fn(&str) -> Option<String>, ) -> Result<Config, ConfigError>
The configuration from variables get answers, as Config::from_env reads them.
Sourcepub fn check(&self) -> Result<(), ConfigError>
pub fn check(&self) -> Result<(), ConfigError>
Checks the configuration: names are DNS names and function names, numbers in range.