Archived
1
0
Fork 0

Configure headless browser address

Add `browser_address` configuration setting to define where is the headless
browser instead of relying on the default value.

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-03-01 13:11:58 +01:00
parent 6f002f007d
commit 45025def65
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
5 changed files with 11 additions and 9 deletions

View file

@ -22,7 +22,7 @@ type Parser struct {
}
// NewParser to create a new Parser instance
func NewParser(includeRegex string, excludeRegex string) (*Parser, error) {
func NewParser(browserAddress string, includeRegex string, excludeRegex string) (*Parser, error) {
var err error
var includeRegexCompiled, excludeRegexCompiled *regexp.Regexp
@ -44,7 +44,7 @@ func NewParser(includeRegex string, excludeRegex string) (*Parser, error) {
log.Debugf("creating context with headless browser drivers")
ctx := context.Background()
ctx = drivers.WithContext(ctx, cdp.NewDriver())
ctx = drivers.WithContext(ctx, cdp.NewDriver(cdp.WithAddress(browserAddress)))
ctx = drivers.WithContext(ctx, http.NewDriver(), drivers.AsDefault())
return &Parser{