Skip to main content

manta_shared/common/
app_context.rs

1//! CLI context struct threaded through `manta-cli`'s call stack.
2//!
3//! The server's analogous `InfraContext` (with backend dispatcher and
4//! per-site URLs) lives in `manta-server::common::app_context` — it
5//! depends on `StaticBackendDispatcher` which the CLI never touches.
6
7use crate::common::kafka::Kafka;
8use config::Config;
9
10/// Top-level CLI context, passed as `&AppContext` through CLI
11/// handlers and commands.
12#[derive(Debug)]
13pub struct AppContext<'a> {
14  /// Site name used to set the `X-Manta-Site` header on outbound
15  /// `MantaClient` requests.
16  pub site_name: &'a str,
17  /// URL of the manta HTTP server this CLI talks to. Required.
18  pub manta_server_url: &'a str,
19  /// Optional default HSM group name from `cli.toml`'s
20  /// `parent_hsm_group`; threaded into the typed `*Params`'
21  /// `settings_hsm_group_name` field by every command that builds one.
22  pub settings_hsm_group_name_opt: Option<&'a str>,
23  /// Optional Kafka audit producer; constructed at startup from
24  /// `cli.toml`'s `[auditor.kafka]` block. `None` disables CLI-side
25  /// audit emission.
26  pub kafka_audit_opt: Option<&'a Kafka>,
27  /// Raw loaded `cli.toml` settings; held alongside the parsed
28  /// `CliConfiguration` so handlers can read fields (e.g. `log`)
29  /// that don't live on the typed struct.
30  pub settings: &'a Config,
31}