Skip to content

Commit

Permalink
Server edits, update server CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Aug 23, 2024
1 parent f8753ad commit 28b4acb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
31 changes: 19 additions & 12 deletions convex-cli/src/main/java/convex/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,7 @@ public int mainExecute(String[] args) {
return ExitCodes.SUCCESS;
}

Level[] verboseLevels = { Level.OFF, Level.WARN, Level.INFO, Level.DEBUG, Level.TRACE, Level.ALL };

if (verbose == null)
verbose = 0;
if (verbose >= 0 && verbose < verboseLevels.length) {
// Set root logger level?
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(verboseLevels[verbose]);
} else {
informError("ERROR: Invalid verbosity level: " + verbose);
return ExitCodes.ERROR;
}
setupVerbosity();

int result = commandLine.execute(args);
return result;
Expand All @@ -150,6 +139,24 @@ public int mainExecute(String[] args) {
}
}

private void setupVerbosity() {
Level[] verboseLevels = { Level.OFF, Level.WARN, Level.INFO, Level.DEBUG, Level.TRACE, Level.ALL };

if (verbose == null)
verbose = 0;
if (verbose >= 0 && verbose < verboseLevels.length) {
// Set root logger level?
try {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(verboseLevels[verbose]);
} catch (Exception e) {
informWarning("Failed to set verbosity level: "+e.getMessage());
}
} else {
throw new CLIError(ExitCodes.USAGE,"Invalid verbosity level: " + verbose);
}
}

/**
* Version provider class
*/
Expand Down
3 changes: 2 additions & 1 deletion convex-cli/src/main/java/convex/cli/peer/PeerStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ private AKeyPair findPeerKey(EtchStore store) {
public void run() {
storeMixin.ensureKeyStore();
try (EtchStore store = etchMixin.getEtchStore()) {

AKeyPair peerKey=findPeerKey(store);
if (peerKey==null) {
informWarning("No --peer-key specified or inferred from Etch Store.");
informWarning("No --peer-key specified or inferred from Etch Store "+store);
showUsage();
return;
}
Expand Down
6 changes: 5 additions & 1 deletion convex-core/src/main/java/etch/EtchStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ protected <T extends ACell> void addToCache(Ref<T> ref) {

@Override
public String toString() {
return "EtchStore at: " + getFileName();
try {
return "EtchStore: " + getFile().getCanonicalPath();
} catch (Exception e) {
return "EtchStore: <File name lookup failed>";
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion convex-peer/src/main/java/convex/peer/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private Server(HashMap<Keyword, Object> config) throws IOException, TimeoutExcep
if (rk==null) rk=peer.getPeerKey();
rootKey=rk;

// Ensure Peer is stored in executor and persisted
// Ensure Peer is stored in executor and initially persisted prior to launch
executor.setPeer(peer);
executor.persistPeerData();

Expand Down
4 changes: 4 additions & 0 deletions convex-restapi/src/main/resources/public/css/pico.min.css

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions convex-restapi/src/main/resources/public/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/pico.min.css">
</head>
<body>

<h1>Convex Peer Server</h1>
Expand Down

0 comments on commit 28b4acb

Please sign in to comment.