Skip to main content

Configuration

Struct Configuration 

Source
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: bool

Whether 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: bool

Whether 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

Source

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.

Source

pub fn api_key(&self) -> Option<String>

The DSN’s userinfo component, percent-decoded: None if the DSN is unset or malformed.

Source

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.

Source

pub fn is_enabled(&self) -> bool

Trait Implementations§

Source§

impl Default for Configuration

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.