Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support safe non-interactive mode #4072

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion applications/tari_console_wallet/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,18 @@ pub(crate) fn boot(cli: &Cli, wallet_config: &WalletConfig) -> Result<WalletBoot
Ok(WalletBoot::Existing)
} else {
// automation/wallet created with --password
if cli.password.is_some() {
if cli.password.is_some() || wallet_config.password.is_some() {
return Ok(WalletBoot::New);
}

// In non-interactive mode, we never prompt. Otherwise, it's not very non-interactive, now is it?
if cli.non_interactive_mode {
let msg = "Wallet does not exist and no password was given to create one. Since we're in non-interactive \
mode, we need to quit here. Try setting the TARI_WALLET__PASSWORD envar, or setting --password \
on the command line";
return Err(ExitError::new(ExitCode::WalletError, &msg));
}

// prompt for new or recovery
let mut rl = Editor::<()>::new();

Expand Down