Skip to content

Commit

Permalink
use bucket and key args
Browse files Browse the repository at this point in the history
  • Loading branch information
Esgrove committed Sep 12, 2023
1 parent 7ff7306 commit c523522
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions rust/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ pub struct Args {
#[arg(long, help = "Print information")]
pub info: bool,

/// Override the KMS key arn for storing or looking up
#[arg(short, long, env = "VAULT_KEY")]
pub key_arn: Option<String>,

/// Print secret value for given key
#[arg(
short,
Expand Down
9 changes: 7 additions & 2 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ impl Vault {
pub async fn new(
vault_stack: Option<&str>,
region_opt: Option<&str>,
bucket: Option<&str>,
key: Option<&str>,
) -> Result<Vault, VaultError> {
let config = aws_config::from_env()
.region(get_region_provider(region_opt))
.load()
.await;
let cloudformation_params =
get_cloudformation_params(&config, vault_stack.unwrap_or("vault")).await?;
let cloudformation_params = if bucket.is_some() && key.is_some() {
CloudFormationParams::from(bucket.unwrap(), key)
} else {
get_cloudformation_params(&config, vault_stack.unwrap_or("vault")).await?
};
Ok(Vault {
region: config.region().unwrap().to_owned(),
cloudformation_params,
Expand Down

0 comments on commit c523522

Please sign in to comment.