[bisq-network/bisq] Torrc (#1893)

Florian Reimair notifications at github.com
Thu Nov 8 15:02:40 UTC 2018


freimair commented on this pull request.



> @@ -330,6 +333,14 @@ protected void customizeOptionParsing(OptionParser parser) {
         parser.accepts(NetworkOptionKeys.SOCKS_5_PROXY_HTTP_ADDRESS,
                 description("A proxy address to be used for Http requests (should be non-Tor). [host:port]", ""))
                 .withRequiredArg();
+        parser.accepts(NetworkOptionKeys.TORRC_FILE,
+                description("An existing torrc-file to be sourced for Tor. Note that torrc-entries, which are critical to Bisqs flawless operation, cannot be overwritten.", ""))
+                .withRequiredArg();
+//                .withValuesConvertedBy(new PathConverter(PathProperties.FILE_EXISTING, PathProperties.READABLE));
+        parser.accepts(NetworkOptionKeys.TORRC_OPTIONS,
+                description("A list of torrc-entries to amend to Bisqs torrc. Note that torrc-entries, which are critical to Bisqs flawless operation, cannot be overwritten. [torrc options line, torrc option, ...]", ""))
+                .withRequiredArg();
+//                .withValuesConvertedBy(RegexMatcher.regex("^([^\\s,]+\\s[^,]+,?\\s*)+$"));

JOptSimple offers input parsing and therefore allows for instant feedback (i.e. showing --help). However, JOptSimple only engages these checks when the value of interest is accessed via `option.valueOf`. So as of now, these lines are disabled.

In order to make Bisq more user friendly, we can do something like:
1) do not use this feature. Errors on command line inputs show up some time later (if manually checked), probably hidden under tons of logs.
2) enable line 339 and 343 above and receive an exception stating the cause
3) change BisqExecutable.java: move line 151: `setupEnvironment(options);` up after line 134, i.e. into the try-catch-block, that houses the initial parsing
4) enable line 339 and 343 and change BisqExecutable::setupEnvironment to something like that:
     ```
    protected void setupEnvironment(OptionSet options) {
        try {
            bisqEnvironment = getBisqEnvironment(options);
        }catch (OptionException e) {
            System.err.println(e.getMessage() + ": " + e.getCause().getMessage());
            // we only tried to load some config, so no graceful shutdown is required
            System.exit(1);
        }
    }
    ```
    resulting in a final log line such as
    ```
    Cannot parse argument '/tmp/torr' of option torrcFile: File [/tmp/torr] does not exist
    ```
5) somehow influence JOptSimple to do the check on parse

IMHO, 4 seems like a good solution. 1 and 2 are not user friendly at all, 3 only states the help index without any detailled information on the error and 5 might probably never happen

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/1893#pullrequestreview-172982255
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20181108/deb6ad3c/attachment-0001.html>


More information about the bisq-github mailing list