Commit e355b6d4 authored by zeroleak's avatar zeroleak
Browse files

fix autorestart

parent bdc5e553
......@@ -148,7 +148,9 @@ public class Application implements ApplicationRunner {
Thread thread =
new Thread(
() -> {
applicationContext.close();
if (applicationContext != null) {
applicationContext.close();
}
String[] restartArgs = computeRestartArgs();
main(restartArgs);
......
package com.samourai.whirlpool.cli.api.controllers.cli;
import com.samourai.whirlpool.cli.Application;
import com.samourai.whirlpool.cli.api.controllers.AbstractRestController;
import com.samourai.whirlpool.cli.api.protocol.CliApiEndpoint;
import com.samourai.whirlpool.cli.api.protocol.beans.ApiCliConfig;
......@@ -44,5 +45,6 @@ public class CliConfigController extends AbstractRestController {
checkHeaders(headers);
cliConfigService.resetConfiguration();
Application.restart();
}
}
......@@ -59,14 +59,11 @@ public class RunCliInit {
String apiKey = cliConfigService.initialize(pairing, tor, null);
log.info(CliUtils.LOG_SEPARATOR);
log.info("⣿ API KEY GENERATED");
log.info("⣿ INITIALIZATION SUCCESS");
log.info("⣿ Take note of your API Key, to connect remotely from GUI or API.");
log.info("⣿ Your API key is: " + apiKey);
log.info(CliUtils.LOG_SEPARATOR);
log.info("");
log.info(CliUtils.LOG_SEPARATOR);
log.info("⣿ INITIALIZATION SUCCESS");
log.info("⣿ Please restart CLI.");
log.info("⣿ ");
log.info("⣿ Restarting CLI...");
log.info(CliUtils.LOG_SEPARATOR);
}
}
......@@ -172,7 +172,7 @@ public class CliConfigService {
}
// restart needed
this.setCliStatusNotReady("CLI restart required. Wallet inizialization success.");
this.setCliStatusNotReady("CLI restart required. Wallet initialization success.");
return apiKey;
}
......@@ -201,6 +201,9 @@ public class CliConfigService {
// save
saveProperties(props);
// restart
Application.restart();
}
public synchronized void setVersionCurrent() throws Exception {
......@@ -227,7 +230,6 @@ public class CliConfigService {
public void setCliStatusNotReady(String error) {
this.setCliStatus(CliStatus.NOT_READY, error);
Application.restart();
}
protected synchronized void save(Properties props) throws Exception {
......@@ -275,7 +277,7 @@ public class CliConfigService {
setVersionCurrent();
// stop wallet & restart needed
this.setCliStatusNotReady("Upgrade success. Please restart.");
this.setCliStatusNotReady("Upgrade success. Restarting CLI...");
shouldRestart = true;
} else {
// up to date
......
......@@ -111,8 +111,10 @@ public class CliService {
// check upgrade
boolean shouldRestart = cliConfigService.checkUpgrade();
if (shouldRestart) {
log.warn(CliUtils.LOG_SEPARATOR);
log.warn("⣿ UPGRADE SUCCESS");
log.warn("⣿ Please restart CLI.");
log.warn("⣿ Restarting CLI...");
log.warn(CliUtils.LOG_SEPARATOR);
return true; // restart
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment