Skip to content

Commit

Permalink
Allow disabling REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Aug 22, 2024
1 parent cc34f9b commit 46c70a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions convex-cli/src/main/java/convex/cli/peer/PeerStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand All @@ -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);
Expand All @@ -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();
Expand Down

0 comments on commit 46c70a3

Please sign in to comment.