pub struct ChaserConfig {
pub context_limit: usize,
pub timeout_ms: u64,
pub profile: Profile,
pub lazy_init: bool,
pub chrome_path: Option<PathBuf>,
pub headless: bool,
pub viewport_width: u32,
pub viewport_height: u32,
pub extra_args: Vec<String>,
}Expand description
Configuration for ChaserCF
Fields§
§context_limit: usizeMaximum concurrent browser contexts (default: 20)
timeout_ms: u64Request timeout in milliseconds (default: 60000)
profile: ProfileStealth profile to use (default: Windows)
lazy_init: boolWhether to defer browser initialization until first use (default: false)
chrome_path: Option<PathBuf>Path to Chrome/Chromium binary (default: auto-detect)
headless: boolWhether to run in headless mode (default: false for stealth)
viewport_width: u32Browser viewport width (default: 1920)
viewport_height: u32Browser viewport height (default: 1080)
extra_args: Vec<String>Extra command-line flags to pass to the Chrome process, appended
to chaser-cf’s defaults (--disable-blink-features=Automation- Controlled, --disable-infobars).
Common values:
--no-sandbox— required when the host process runs as root (e.g. systemd unit, Docker containers without--user), otherwise Chrome refuses to start with the message “Running as root without –no-sandbox is not supported”.--disable-gpu— for headless servers without a GPU.--disable-dev-shm-usage— for /dev/shm-constrained containers.
Default: empty (chaser-cf only sets its own minimum baseline flags).
Implementations§
Source§impl ChaserConfig
impl ChaserConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create configuration from environment variables
Environment variables:
CHASER_CONTEXT_LIMIT: Max concurrent contexts (default: 20)CHASER_TIMEOUT: Timeout in ms (default: 60000)CHASER_PROFILE: Profile name (windows/linux/macos)CHASER_LAZY_INIT: Enable lazy init (true/false)CHROME_BIN: Path to Chrome binaryCHASER_HEADLESS: Run headless (true/false)CHASER_EXTRA_ARGS: Whitespace-separated Chrome flags appended to chaser-cf’s defaults (e.g.--no-sandbox --disable-gpu)
Sourcepub fn with_context_limit(self, limit: usize) -> Self
pub fn with_context_limit(self, limit: usize) -> Self
Builder method: set context limit
Sourcepub fn with_timeout_ms(self, timeout: u64) -> Self
pub fn with_timeout_ms(self, timeout: u64) -> Self
Builder method: set timeout
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Builder method: set timeout from Duration
Sourcepub fn with_profile(self, profile: Profile) -> Self
pub fn with_profile(self, profile: Profile) -> Self
Builder method: set profile
Sourcepub fn with_lazy_init(self, lazy: bool) -> Self
pub fn with_lazy_init(self, lazy: bool) -> Self
Builder method: enable lazy initialization
Sourcepub fn with_chrome_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_chrome_path(self, path: impl Into<PathBuf>) -> Self
Builder method: set Chrome path
Sourcepub fn with_headless(self, headless: bool) -> Self
pub fn with_headless(self, headless: bool) -> Self
Builder method: set headless mode
Sourcepub fn with_viewport(self, width: u32, height: u32) -> Self
pub fn with_viewport(self, width: u32, height: u32) -> Self
Builder method: set viewport size
Sourcepub fn with_extra_args<I, S>(self, args: I) -> Self
pub fn with_extra_args<I, S>(self, args: I) -> Self
Builder method: replace the extra Chrome args set with the given list.
Use Self::add_extra_arg to append a single flag instead.
Sourcepub fn add_extra_arg(self, arg: impl Into<String>) -> Self
pub fn add_extra_arg(self, arg: impl Into<String>) -> Self
Builder method: append a single Chrome flag to the existing extras.
Useful for chaining, e.g.
ChaserConfig::default().add_extra_arg("--no-sandbox").
Trait Implementations§
Source§impl Clone for ChaserConfig
impl Clone for ChaserConfig
Source§fn clone(&self) -> ChaserConfig
fn clone(&self) -> ChaserConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more