From 46c70a30fe13f1c59a5ee93fe1e1de04969ac88d Mon Sep 17 00:00:00 2001 From: mikera Date: Thu, 22 Aug 2024 16:46:05 +0100 Subject: [PATCH] Allow disabling REST API --- convex-cli/src/main/java/convex/cli/peer/PeerStart.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/convex-cli/src/main/java/convex/cli/peer/PeerStart.java b/convex-cli/src/main/java/convex/cli/peer/PeerStart.java index c4cdb827f..8366f4124 100644 --- a/convex-cli/src/main/java/convex/cli/peer/PeerStart.java +++ b/convex-cli/src/main/java/convex/cli/peer/PeerStart.java @@ -127,7 +127,6 @@ public void run() { if (controller==null) { paranoia("--address for peer controller not specified"); log.debug("Controller address not specified."); - } RESTServer restServer=null;; @@ -137,9 +136,10 @@ public void run() { config.put(Keywords.STORE, store); Server server=API.launchPeer(config); - restServer=RESTServer.create(server); - restServer.start(apiport); - + if (!norest) { + restServer=RESTServer.create(server); + restServer.start(apiport); + } while (server.isRunning()&&!Thread.currentThread().isInterrupted()) { Thread.sleep(400); @@ -149,6 +149,7 @@ public void run() { throw new CLIError(ExitCodes.CONFIG,"Error in peer configuration: "+t.getMessage(),t); } catch (InterruptedException e) { informWarning("Peer interrupted before normal shutdown"); + Thread.currentThread().interrupt(); return; } finally { if (restServer!=null) restServer.stop();