pub struct Configuration {
pub dsn: Option<String>,
pub environment: String,
pub release: Option<String>,
pub server_name: Option<String>,
pub app_root: Option<String>,
pub enabled_environments: HashSet<String>,
pub queue_size: usize,
pub timeout: Duration,
pub scrub_pii: bool,
pub install_panic_hook: bool,
pub capture_source_context: bool,
}Expand description
Holds a single ForgeOps DSN plus everything else the client needs to build and deliver events. Mirrors gems/forge_ops_tracker’s Configuration: a single DSN string carries both the ingestion URL and the project’s API key: “https://<api_key>@host/api/v1/events”.
Fields§
§dsn: Option<String>§environment: String§release: Option<String>§server_name: Option<String>§app_root: Option<String>Decides whether a backtrace frame is “in_app”: a frame’s file path is compared against this root, the same file-path matching the Ruby gem does against Rails.root and the Python client does against os.getcwd(). A Rust binary built with debug info embeds real build-time source paths, so the same approach works here too. Defaults to the current working directory; set it explicitly if that doesn’t match your app’s actual layout.
enabled_environments: HashSet<String>§queue_size: usize§timeout: Duration§scrub_pii: bool§install_panic_hook: boolWhether init() installs the global panic hook (see lib.rs’s install_panic_hook) that
reports anything that panics on any thread, with zero further wiring: the same
“unhandled needs no wiring” case Rails.error/ASP.NET Core’s middleware and Python’s
excepthook wrapper cover automatically for their own languages. Doesn’t change panic
behavior (the previously-installed hook still runs afterward), so on by default is safe;
set false to opt out.
capture_source_context: boolWhether EventBuilder reads a few lines of source off disk around each in-app frame’s
culprit line (see event_builder.rs’s attach_source_context). Defaults to true so a
snippet shows up with zero extra setup, but this field isn’t the durable protection
against literal source code leaving a deployment it shouldn’t: ForgeOps’ own per-project
setting is, since it applies server-side regardless of what any given app happens to have
this field set to locally. Set false here if this app should never even attempt the disk
read in the first place.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn new() -> Self
pub fn new() -> Self
Seeds a Configuration from FORGE_OPS_DSN/FORGE_OPS_ENVIRONMENT/FORGE_OPS_RELEASE and sensible defaults for everything else: the same env vars and defaults every other client in this repo reads.
Sourcepub fn api_key(&self) -> Option<String>
pub fn api_key(&self) -> Option<String>
The DSN’s userinfo component, percent-decoded: None if the DSN is unset or malformed.
Sourcepub fn ingestion_uri(&self) -> Option<String>
pub fn ingestion_uri(&self) -> Option<String>
The ingestion URL with credentials stripped out: they travel as the Authorization header instead, never embedded in the request URI.