[bisq-network/bisq] Minimal api (#3001)

Florian Reimair notifications at github.com
Fri Aug 2 17:05:50 UTC 2019


freimair requested changes on this pull request.

Sorry for letting you wait so long. 

Please use the correct file header (featuring "Bisq" instead of "Bitsquare") and add it to any source file.

IMHO, we do not need the docker config yet. That is a thing we can feature once the API is completed and hardened. Or does that affect the really nice test setup?

> +    private void setupAuth(ServletContextHandler appContextHandler) {
+        AuthFilter authFilter = new AuthFilter(apiPasswordManager, tokenRegistry);
+        appContextHandler.addFilter(new FilterHolder(authFilter), "/*", EnumSet.allOf(DispatcherType.class));
+    }
+
+    /**
+     * If Bisq is configured to use start Tor then the default Tor instance should be available
+     * by the time this method is executed.
+     */
+    private void startTorIfNeeded() throws IOException, TorCtlException {
+        Tor tor = Tor.getDefault();
+        if (null == tor) {
+            log.info("Tor not started so API will be available only locally");
+            return;
+        }
+        // TODO how to log that service has been published?

```suggestion

```

> +        AuthFilter authFilter = new AuthFilter(apiPasswordManager, tokenRegistry);
+        appContextHandler.addFilter(new FilterHolder(authFilter), "/*", EnumSet.allOf(DispatcherType.class));
+    }
+
+    /**
+     * If Bisq is configured to use start Tor then the default Tor instance should be available
+     * by the time this method is executed.
+     */
+    private void startTorIfNeeded() throws IOException, TorCtlException {
+        Tor tor = Tor.getDefault();
+        if (null == tor) {
+            log.info("Tor not started so API will be available only locally");
+            return;
+        }
+        // TODO how to log that service has been published?
+        final HsContainer hsContainer = tor.publishHiddenService("api", 80, bisqEnvironment.getHttpApiPort());

```suggestion
        final HsContainer hsContainer = tor.publishHiddenService("api", 80, bisqEnvironment.getHttpApiPort());
                hsContainer.getHandler().attachHSReadyListener(hsContainer.getHostname(), () -> {
            log.info("API hidden service is published and ready");
            return null;
        });
```

-- 
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/3001#pullrequestreview-270290115
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190802/a99472cc/attachment.html>


More information about the bisq-github mailing list