Skip to content

Commit

Permalink
chore: prepare simple switch workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bbortt committed Jul 4, 2024
1 parent 4b875f9 commit 60ac1bf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ pub(crate) struct BaseArgs {
pub(crate) struct RotateArgs {
#[clap(flatten)] // Inherit arguments from BaseArgs
pub(crate) base: BaseArgs,
// Additional arguments for rotation (if any) can be added here.

/// Whether the CLI should write a recovery log (contains sensitive information!) or not
#[clap(short, long, default_value = "20")]
pub(crate) password_length: i8,

/// Whether the CLI should write a recovery log (contains sensitive information!) or not
#[clap(short, long)]
pub(crate) write_recovery_log: bool,
}

/// Arguments specific to the `init-vault` subcommand.
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use log::debug;
use serde::Deserialize;
use std::{fs::File, io::Read, path::PathBuf};
use log::debug;

#[derive(Deserialize, Debug)]
pub(crate) struct Config {
Expand Down
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ use config::Config;
use crate::cli::{CliArgs, Command};
use crate::config::read_config;
use crate::vault::Vault;
use crate::workflow::switch_active_users;

mod cli;
mod config;
mod vault;
mod workflow;

fn main() {
init_logger();
Expand All @@ -22,7 +24,11 @@ fn main() {
let mut vault: Vault = Vault::connect(&config);
vault.init_secret_path()
}
Command::Rotate(_) => {}
Command::Rotate(rotate_args) => {
let config: Config = read_config(rotate_args.base.config_path);
let vault: Vault = Vault::connect(&config);
switch_active_users(&config, &vault)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/vault.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::env;
use log::info;
use serde::{Deserialize, Serialize};
use std::env;
use tokio::runtime::{Builder, Runtime};
use vaultrs::client::{VaultClient, VaultClientSettingsBuilder};
use vaultrs::kv2;
Expand Down
4 changes: 4 additions & 0 deletions src/workflow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
use crate::config::Config;
use crate::vault::Vault;

pub(crate) fn switch_active_users(config: &Config, vault: &Vault) {}

Check warning on line 4 in src/workflow.rs

View workflow job for this annotation

GitHub Actions / Rust Build

unused variable: `config`

Check warning on line 4 in src/workflow.rs

View workflow job for this annotation

GitHub Actions / Rust Build

unused variable: `vault`

Check warning on line 4 in src/workflow.rs

View workflow job for this annotation

GitHub Actions / Rust Build

unused variable: `config`

Check warning on line 4 in src/workflow.rs

View workflow job for this annotation

GitHub Actions / Rust Build

unused variable: `vault`

Check warning on line 4 in src/workflow.rs

View workflow job for this annotation

GitHub Actions / Rust Build

unused variable: `config`

Check warning on line 4 in src/workflow.rs

View workflow job for this annotation

GitHub Actions / Rust Build

unused variable: `vault`

0 comments on commit 60ac1bf

Please sign in to comment.