Skip to content

Commit

Permalink
fix resolver config
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Jul 22, 2024
1 parent f86f527 commit 2f2e98d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/actions/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub enum Advanced {
Uninstall,
#[describe("Toggle sudo password")]
SudoersEntry,
#[describe("Generate resolver key")]
ResolverKey,
}

impl Action for Advanced {
Expand Down Expand Up @@ -130,6 +132,10 @@ impl Action for Advanced {
sudo::toggle_sudoers_entry(ctx).ok();
Ok(true)
}
Advanced::ResolverKey => {
resolver::init_resolver_config(ctx)?;
Ok(true)
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/actions/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ use crate::imports::*;
pub enum Update {
#[describe("Back")]
Back,
#[describe("Update Kaspa services")]
#[describe("Update all Kaspa services")]
Services,
#[describe("OS prerequisites")]
Os,
#[describe("Rust Compiler")]
RustC,
#[describe("Resolver")]
Resolver,
#[describe("Kaspa p2p node")]
Kaspad,
#[describe("Resolver")]
Resolver,
}

impl Action for Update {
Expand Down
16 changes: 10 additions & 6 deletions src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ pub fn stop(ctx: &Context) -> Result<()> {
}

pub fn restart(ctx: &Context) -> Result<()> {
step("Restarting resolver...", || {
step("Restarting 'kaspa-resolver'", || {
systemd::restart(&ctx.config.resolver)
})
}
Expand Down Expand Up @@ -315,9 +315,13 @@ pub fn check_for_updates(ctx: &Context) -> Result<()> {
Ok(())
}

pub fn reconfigure(_ctx: &Context, _force: bool) -> Result<()> {
// let mut reconfigure_systemd = false;

pub fn reconfigure(ctx: &Context, _force: bool) -> Result<()> {
step("Configuring 'kaspa-resolver'", || {
create_systemd_unit(ctx, &ctx.config.resolver)?;
systemd::daemon_reload()?;
Ok(())
})?;
restart(ctx)?;
Ok(())
}

Expand Down Expand Up @@ -426,8 +430,8 @@ pub fn generate_key(prefix: Option<u16>) -> Result<()> {
return Ok(());
}

match cliclack::password("Enter password:").interact() {
Ok(password1) => match cliclack::password("Enter password:").interact() {
match cliclack::password("Enter passphrase:").interact() {
Ok(password1) => match cliclack::password("Enter passphrase:").interact() {
Ok(password2) => {
if password1 != password2 {
return Err(Error::PasswordsDoNotMatch);
Expand Down

0 comments on commit 2f2e98d

Please sign in to comment.