Skip to content

Commit fe7b874

Browse files
authored
allow custom chrome flags (#866)
1 parent 75fc7d1 commit fe7b874

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

pkg/config/base.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ type BaseConfig struct {
5252
BackupConfig *StorageConfig `yaml:"backup,omitempty"` // backup config, for storage failures
5353

5454
// dev/debugging
55-
Insecure bool `yaml:"insecure"` // allow chrome to connect to an insecure websocket
56-
Debug DebugConfig `yaml:"debug"` // create dot file on internal error
55+
Insecure bool `yaml:"insecure"` // allow chrome to connect to an insecure websocket
56+
Debug DebugConfig `yaml:"debug"` // create dot file on internal error
57+
ChromeFlags map[string]interface{} `yaml:"chrome_flags"` // additional flags to pass to Chrome
5758
}
5859

5960
type DebugConfig struct {

pkg/pipeline/source/web.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,21 @@ func (s *WebSource) launchChrome(ctx context.Context, p *config.PipelineConfig)
237237
chromedp.Flag("enable-automation", false),
238238
chromedp.Flag("autoplay-policy", "no-user-gesture-required"),
239239
chromedp.Flag("window-position", "0,0"),
240+
241+
// config
240242
chromedp.Flag("window-size", fmt.Sprintf("%d,%d", p.Width, p.Height)),
243+
chromedp.Flag("disable-web-security", p.Insecure),
244+
chromedp.Flag("allow-running-insecure-content", p.Insecure),
245+
chromedp.Flag("no-sandbox", !p.EnableChromeSandbox),
241246

242247
// output
243248
chromedp.Env(fmt.Sprintf("PULSE_SINK=%s", p.Info.EgressId)),
244249
chromedp.Flag("display", p.Display),
245-
246-
// sandbox
247-
chromedp.Flag("no-sandbox", !p.EnableChromeSandbox),
248250
}
249251

250-
if p.Insecure {
251-
opts = append(opts,
252-
chromedp.Flag("disable-web-security", true),
253-
chromedp.Flag("allow-running-insecure-content", true),
254-
)
252+
// custom
253+
for k, v := range p.ChromeFlags {
254+
opts = append(opts, chromedp.Flag(k, v))
255255
}
256256

257257
allocCtx, allocCancel := chromedp.NewExecAllocator(context.Background(), opts...)

0 commit comments

Comments
 (0)