Skip to content

Commit

Permalink
chore: rename daemon mode to non-interactive mode (#3134)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->
Simple rename from `--daemon` to `--non-interactive`.

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
Daemon was a misnomer and did not start a background process.

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
Console wallet starts without UI when `--non-interactive` is passed to it.

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
* [x] I'm merging against the `development` branch.
* [x] I have squashed my commits into a single commit.
  • Loading branch information
aviator-app[bot] committed Jul 27, 2021
2 parents 78b7dbe + 3bf9b1b commit bd67d6c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
6 changes: 2 additions & 4 deletions applications/tari_base_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,8 @@ async fn run_node(node_config: Arc<GlobalConfig>, bootstrap: ConfigBootstrap) ->
}

// Run, node, run!
// TODO: We are not starting a background process/daemon. Either we should do that or call this mode
// `--non-interactive`
if bootstrap.daemon_mode {
println!("Node started in daemon mode (pid = {})", process::id());
if bootstrap.non_interactive_mode {
println!("Node started in non-interactive mode (pid = {})", process::id());
} else {
let command_handler = Arc::new(CommandHandler::new(runtime::Handle::current(), &ctx));
let parser = Parser::new(command_handler);
Expand Down
4 changes: 2 additions & 2 deletions applications/tari_console_wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ The standard operating mode, TUI mode is the default when starting `tari_console

![](./docs/img/tui.png)

## Daemon (GRPC) mode
## Non-interactive (GRPC) mode

Run as a server with no UI, but exposing the GRPC interface with `tari_console_wallet --daemon`.
Run as a server with no UI, but exposing the GRPC interface with `tari_console_wallet --non-interactive`.

## Command mode

Expand Down
6 changes: 3 additions & 3 deletions applications/tari_console_wallet/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,21 @@ pub async fn get_base_node_peer_config(
pub fn wallet_mode(bootstrap: &ConfigBootstrap, boot_mode: WalletBoot) -> WalletMode {
// Recovery mode
if matches!(boot_mode, WalletBoot::Recovery) {
if bootstrap.daemon_mode {
if bootstrap.non_interactive_mode {
return WalletMode::RecoveryDaemon;
} else {
return WalletMode::RecoveryTui;
}
}

match (
bootstrap.daemon_mode,
bootstrap.non_interactive_mode,
bootstrap.input_file.clone(),
bootstrap.command.clone(),
) {
// TUI mode
(false, None, None) => WalletMode::Tui,
// GRPC daemon mode
// GRPC mode
(true, None, None) => WalletMode::Grpc,
// Script mode
(_, Some(path), None) => WalletMode::Script(path),
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_console_wallet/src/wallet_modes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn wallet_or_exit(config: WalletModeConfig, wallet: WalletSqlite) -> Result<(),
return Ok(());
}

if config.bootstrap.daemon_mode {
if config.bootstrap.non_interactive_mode {
info!(target: LOG_TARGET, "Starting GRPC server.");
grpc_mode(config, wallet)
} else {
Expand Down
8 changes: 4 additions & 4 deletions common/src/configuration/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ pub struct ConfigBootstrap {
/// Create and save new node identity if one doesn't exist
#[structopt(long, alias = "create_id")]
pub create_id: bool,
/// Run in daemon mode, with no interface
#[structopt(short, long, alias = "daemon")]
pub daemon_mode: bool,
/// Run in non-interactive mode, with no UI.
#[structopt(short, long, alias = "non-interactive")]
pub non_interactive_mode: bool,
/// This will rebuild the db, adding block for block in
#[structopt(long, alias = "rebuild_db")]
pub rebuild_db: bool,
Expand Down Expand Up @@ -163,7 +163,7 @@ impl Default for ConfigBootstrap {
log_config: normalize_path(dir_utils::default_path(DEFAULT_BASE_NODE_LOG_CONFIG, None)),
init: false,
create_id: false,
daemon_mode: false,
non_interactive_mode: false,
rebuild_db: false,
input_file: None,
command: None,
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/helpers/walletProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class WalletProcess {
`${password ? password : "kensentme"}`,
"--seed-words-file-name",
this.seedWordsFile,
"--daemon",
"--non-interactive",
];
if (this.recoverWallet) {
args.push("--recover", "--seed-words", this.seedWords);
Expand Down

0 comments on commit bd67d6c

Please sign in to comment.