Opened 4 years ago
Closed 2 years ago
#3943 closed change (rejected)
Configuration file for abpcrawler
Reported by: | sergz | Assignee: | sergz |
---|---|---|---|
Priority: | Unknown | Milestone: | |
Module: | Extensions-for-Adblock-Plus | Keywords: | abpcrawler |
Cc: | trev, fhd, TobiasHilleke, philll, tschuster | Blocked By: | |
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description
Background
Currently we can configure
- path to file with URLs
- subscription URLs or path on the file system
- output directory
- maximum number of simultaneously opened tabs
- timeout to stop waiting for the finishing of the page loading
- path to firefox executable
Taking into account at least #3940 and #3941 it seems we need an option to read parameters from a configuration file.
What to change
Before we start to add the support of it we should agree on the format of the config file.
Change History (6)
comment:1 Changed 4 years ago by trev
comment:2 follow-up: ↓ 3 Changed 4 years ago by sergz
I completely agree with using of JSON and long-named command line parameters as properties.
Merely would like to precise a couple of details:
- path to config file is specified by special command line parameter (e.g. -c --config)
- config file cannot reference another config file
- parameters passed through the command line in addition to config file override the values from config file
comment:3 in reply to: ↑ 2 Changed 4 years ago by trev
Replying to sergz:
- path to config file is specified by special command line parameter (e.g. -c --config)
Yes, -c and --config is what you usually have.
- config file cannot reference another config file
Of course not, config file can only be specified on the command line.
- parameters passed through the command line in addition to config file override the values from config file
Yes, command line parameters take precedence.
comment:4 Changed 3 years ago by sergz
- Review URL(s) modified (diff)
- Status changed from new to reviewing
comment:5 Changed 3 years ago by sergz
- Owner set to sergz
comment:6 Changed 2 years ago by trev
- Resolution set to rejected
- Status changed from reviewing to closed
Mass-closing all bugs in the Extensions for Adblock Plus module, these extensions no longer work as of Adblock Plus 3.0 / Firefox 57.
First of all, it would be nice if the config file would simply mirror command line parameters - so specifying a config file would simply replace a bunch of command line parameters. This has the advantage that things don't need to be documented twice, it's the same interface both via command line and config file.
As to the format, I guess that JSON makes the most sense:
I'd normally suggest a format with less syntactical overhead but XML is worse syntax-wise and the INI format (via ConfigParser) requires section headers which don't make sense here. YAML might be a good option but it isn't supported by Python natively.
See https://martin-thoma.com/configuration-files-in-python/ for a seemingly complete overview.