Skip to content

Comments

feat: add chrome_args configuration for custom Chrome flags#47

Merged
sonesuke merged 3 commits intomainfrom
fix/docker-chrome-sandbox
Feb 23, 2026
Merged

feat: add chrome_args configuration for custom Chrome flags#47
sonesuke merged 3 commits intomainfrom
fix/docker-chrome-sandbox

Conversation

@sonesuke
Copy link
Owner

@sonesuke sonesuke commented Feb 23, 2026

Summary

Add chrome_args configuration option to allow users to specify custom Chrome/Chromium flags via config file. This is useful for Docker/devcontainer environments where Chrome requires additional flags like --no-sandbox to work properly.

Problem

Previously, Chrome flags for CI/Docker environments (--no-sandbox, --disable-setuid-sandbox) were only automatically added when the CI environment variable was set. This didn't work for devcontainer environments which don't have CI=true set.

Solution

Add a chrome_args configuration option that allows users to specify custom Chrome flags in their config file:

chrome_args = ["--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu"]

Changes

  • Config (src/core/config.rs): Add chrome_args field (Vec)
  • BrowserManager (src/core/cdp/browser.rs): Accept and apply chrome_args
  • PatentSearcher (src/core/patent_search.rs): Pass chrome_args to BrowserManager
  • CLI (src/cli/mod.rs): Pass chrome_args from config to PatentSearcher
  • MCP (src/mcp/mod.rs): Pass chrome_args from config to PatentSearcher
  • README.md: Add documentation for chrome_args configuration

Configuration Example

# ~/.config/google-patent-cli/config.toml
browser_path = "/usr/bin/google-chrome"

# For Docker/devcontainer environments
chrome_args = [
    "--no-sandbox",
    "--disable-setuid-sandbox",
    "--disable-gpu"
]

CI Environment

When CI=true is set, the following flags are automatically added:

  • --disable-gpu
  • --no-sandbox
  • --disable-setuid-sandbox

Test plan

  • Pre-commit checks pass (fmt, clippy, test)
  • Config parsing works with chrome_args
  • CLI passes chrome_args to BrowserManager
  • README documentation added

🤖 Generated with Claude Code

Running Chrome in Docker containers or CI environments requires
additional flags to work properly. This commit adds --no-sandbox
and --disable-setuid-sandbox flags when CI environment variable
is detected.

Changes:
- Add --no-sandbox flag in CI environments
- Add --disable-setuid-sandbox flag in CI environments

These flags are essential for running Chrome in containerized
environments where sandboxing may not work properly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add chrome_args configuration option to allow users to specify
custom Chrome/Chromium flags via config file. This is useful for
Docker/devcontainer environments where Chrome requires additional
flags like --no-sandbox to work properly.

Changes:
- Add chrome_args field to Config (Vec<String>)
- Pass chrome_args from Config to BrowserManager
- Apply custom Chrome args in get_browser method
- Update README.md with configuration documentation

Users can now configure Chrome flags in config.toml:
  chrome_args = ["--no-sandbox", "--disable-setuid-sandbox"]

This provides flexibility while keeping CI environment auto-detection
(when CI=true is set, --no-sandbox is automatically added).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@sonesuke sonesuke force-pushed the fix/docker-chrome-sandbox branch from ff35039 to 81cd6e0 Compare February 23, 2026 06:04
@sonesuke sonesuke changed the title fix: add --no-sandbox flags for Chrome in CI/Docker environments feat: add chrome_args configuration for custom Chrome flags Feb 23, 2026
@sonesuke sonesuke merged commit 42f01c0 into main Feb 23, 2026
4 checks passed
@sonesuke sonesuke deleted the fix/docker-chrome-sandbox branch February 23, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants