mirror of
https://github.com/perstarkse/minne.git
synced 2026-07-04 20:11:42 +02:00
chore: ingestion-pipeline refactor, sort technical debt, rustfmt
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
use common::error::AppError;
|
||||
use headless_chrome::Browser;
|
||||
|
||||
/// Launches a headless Chrome instance, honoring the `docker` feature flag
|
||||
/// (which disables the Chrome sandbox for container environments).
|
||||
///
|
||||
/// This is the single place the crate spawns a browser. If the rendering backend
|
||||
/// is ever swapped away from headless Chrome to something leaner, this function is
|
||||
/// the seam to change; callers only depend on getting back a `Browser`.
|
||||
pub(crate) fn launch_browser() -> Result<Browser, AppError> {
|
||||
#[cfg(feature = "docker")]
|
||||
{
|
||||
let options = headless_chrome::LaunchOptionsBuilder::default()
|
||||
.sandbox(false)
|
||||
.build()
|
||||
.map_err(|err| {
|
||||
AppError::Processing(format!("Failed to build headless browser options: {err}"))
|
||||
})?;
|
||||
Browser::new(options)
|
||||
.map_err(|err| AppError::Processing(format!("Failed to start headless browser: {err}")))
|
||||
}
|
||||
#[cfg(not(feature = "docker"))]
|
||||
{
|
||||
Browser::default()
|
||||
.map_err(|err| AppError::Processing(format!("Failed to start headless browser: {err}")))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user