Commit fea3d5db authored by zeroleak's avatar zeroleak
Browse files

add CliStatus.STARTING

parent d0dd5873
......@@ -32,6 +32,7 @@ public class CliApiEndpoint {
REST_CLI_INIT,
REST_CLI_LOGIN,
REST_CLI_LOGOUT,
REST_CLI_RESTART,
REST_CLI_CONFIG,
REST_POOLS,
REST_WALLET_DEPOSIT,
......
package com.samourai.whirlpool.cli.beans;
public enum CliStatus {
STARTING,
NOT_INITIALIZED,
NOT_READY,
READY;
......
......@@ -52,9 +52,9 @@ public class CliConfigService {
public CliConfigService(CliConfig cliConfig) {
this.cliConfig = cliConfig;
this.cliStatus = CliStatus.NOT_INITIALIZED;
if (!Strings.isEmpty(cliConfig.getSeed()) && !Strings.isEmpty(cliConfig.getApiKey())) {
this.setCliStatus(CliStatus.READY);
this.cliStatus = CliStatus.STARTING;
if (Strings.isEmpty(cliConfig.getSeed()) || Strings.isEmpty(cliConfig.getApiKey())) {
this.setCliStatus(CliStatus.NOT_INITIALIZED);
}
}
......
......@@ -3,6 +3,7 @@ package com.samourai.whirlpool.cli.services;
import com.samourai.whirlpool.cli.ApplicationArgs;
import com.samourai.whirlpool.cli.beans.CliProxy;
import com.samourai.whirlpool.cli.beans.CliResult;
import com.samourai.whirlpool.cli.beans.CliStatus;
import com.samourai.whirlpool.cli.config.CliConfig;
import com.samourai.whirlpool.cli.exception.AuthenticationException;
import com.samourai.whirlpool.cli.exception.NoSessionWalletException;
......@@ -105,6 +106,13 @@ public class CliService {
log.debug("[cliConfig/" + entry.getKey() + "] " + entry.getValue());
}
}
if (listen) {
String info = "API is listening on https://127.0.0.1:" + cliConfig.getApi().getPort();
if (cliConfig.getApi().isHttpEnable()) {
info += " and http://127.0.0.1:" + cliConfig.getApi().getHttpPort();
}
log.info(info);
}
// connect Tor
cliTorClientService.connect();
......@@ -145,15 +153,7 @@ public class CliService {
log.warn(CliUtils.LOG_SEPARATOR);
return CliResult.RESTART;
}
if (listen) {
String info = "API is listening on https://127.0.0.1:" + cliConfig.getApi().getPort();
if (cliConfig.getApi().isHttpEnable()) {
info += " and http://127.0.0.1:" + cliConfig.getApi().getHttpPort();
}
log.info(info);
}
cliConfigService.setCliStatus(CliStatus.READY);
if (!appArgs.isAuthenticate()
&& listen
&& !RunCliCommand.hasCommandToRun(appArgs, cliConfig)) {
......
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