balena-io-experimental / browser

A drop-in web browser block
96 stars 70 forks source link

Add EXTRA_FLAGS for extended flag support #160

Closed bbugh closed 9 months ago

bbugh commented 9 months ago

This adds a new environment variable EXTRA_FLAGS so we can extend the existing flags passed to Chromium instead of clobbering them all with FLAGS and trying to reproduce the whole list ourselves.

For example, for our IoT project we need --audio-buffer-size=2048 and --audio-output-channels=8, so we can do this:

services:
  browser:
    image: bh.cr/balenalabs/browser-<arch>
    environment:
      EXTRA_FLAGS: --audio-buffer-size=2048 --audio-output-channels=8

instead of having this monstrosity (which requires us to keep track of window sizes):

services:
  browser:
    image: bh.cr/balenalabs/browser-<arch>
    environment:
      FLAGS: >-
        --disable-features=TranslateUI
        --disable-component-extensions-with-background-pages
        --disable-background-networking
        --disable-sync
        --metrics-recording-only
        --disable-default-apps
        --no-default-browser-check
        --no-first-run
        --disable-backgrounding-occluded-windows
        --disable-renderer-backgrounding
        --disable-background-timer-throttling
        --force-fieldtrials=*BackgroundTracing/default/
        --window-size=1920,1080
        --window-position=0,0
        --autoplay-policy=no-user-gesture-required
        --noerrdialogs
        --disable-session-crashed-bubble
        --check-for-update-interval=31536000
        --disable-dev-shm-usage
        --enable-zero-copy
        --num-raster-threads=4
        --ignore-gpu-blocklist
        --enable-gpu-rasterization
        --audio-buffer-size=2048
        --audio-output-channels=8
bbugh commented 9 months ago

Force pushed change-type: minor amend to the message for the CI.