1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Use TOML as config file format in downloader (#405)

* Use TOML as config file format.

* Parse command line a second time if config file was loaded.

* Handle default values correctly.

* Use same names for config file options and command line options.
This commit is contained in:
Sascha L. Teichmann 2023-07-20 11:05:20 +02:00 committed by GitHub
parent 8630e8bac2
commit 81ead2776b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 136 additions and 77 deletions

View file

@ -7,21 +7,21 @@ A tool to download CSAF documents from CSAF providers.
csaf_downloader [OPTIONS] domain...
Application Options:
-d, --directory=DIR DIRectory to store the downloaded files in
--insecure Do not check TLS certificates from provider
--ignoresigcheck Ignore signature check results, just warn on mismatch
--version Display version of the binary
-v, --verbose Verbose output
-r, --rate= The average upper limit of https operations per second (defaults to unlimited)
-w, --worker=NUM NUMber of concurrent downloads (default: 2)
-H, --header= One or more extra HTTP header fields
--validator=URL URL to validate documents remotely
--validatorcache=FILE FILE to cache remote validations
--validatorpreset= One or more presets to validate remotely (default: mandatory)
-c, --config=INI-FILE Path to config ini file
-d, --directory=DIR DIRectory to store the downloaded files in
--insecure Do not check TLS certificates from provider
--ignoresigcheck Ignore signature check results, just warn on mismatch
--version Display version of the binary
-v, --verbose Verbose output
-r, --rate= The average upper limit of https operations per second (defaults to unlimited)
-w, --worker=NUM NUMber of concurrent downloads (default: 2)
-H, --header= One or more extra HTTP header fields
--validator=URL URL to validate documents remotely
--validatorcache=FILE FILE to cache remote validations
--validatorpreset=PRESETS One or more PRESETS to validate remotely (default: [mandatory])
-c, --config=TOML-FILE Path to config TOML file
Help Options:
-h, --help Show this help message
-h, --help Show this help message
```
Will download all CSAF documents for the given _domains_, by trying each as a CSAF provider.
@ -35,9 +35,9 @@ have taken countermeasures to limit this.
If no config file is explictly given the follwing places are searched for a config file:
```
~/.config/csaf/downloader.ini
~/.csaf_downloader.ini
csaf_downloader.ini
~/.config/csaf/downloader.toml
~/.csaf_downloader.toml
csaf_downloader.toml
```
with `~` expanding to `$HOME` on unixoid systems and `%HOMEPATH` on Windows systems.
@ -53,5 +53,5 @@ worker = 2
# header # not set by default
# validator # not set by default
# validatorcache # not set by default
validatorpreset = "mandatory"
validatorpreset = ["mandatory"]
```