Skip to content

Commit

Permalink
feat: pass env to sub processes (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
zifeo authored Oct 2, 2023
1 parent 9d1e7cc commit 28a48dd
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resolver = "2"

[package]
name = "lade"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
description = "Automatically load secrets from your preferred vault as environment variables, and clear them once your shell command is over."
license = "MPL-2.0"
Expand All @@ -24,7 +24,7 @@ serde = { version = "1.0.188", features = ["derive"] }
serde_yaml = "0.9.25"
clap = { version = "4.4.6", features = ["derive"] }
regex = "1.9.6"
lade-sdk = { path = "./sdk", version = "0.9.0" }
lade-sdk = { path = "./sdk", version = "0.9.1" }
tokio = { version = "1", features = ["full"] }
indexmap = { version = "2.0.2", features = ["serde"] }
clap-verbosity-flag = "2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lade-sdk"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
description = "Lade SDK"
license = "MPL-2.0"
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/providers/doppler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{collections::HashMap, path::Path};

use crate::Hydration;
use crate::{providers::envs, Hydration};
use anyhow::{anyhow, bail, Result};
use async_process::{Command, Stdio};
use async_trait::async_trait;
Expand Down Expand Up @@ -89,6 +89,7 @@ impl Provider for Doppler {

let child = match Command::new(cmd[0])
.args(&cmd[1..])
.envs(envs())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/providers/infisical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{collections::HashMap, fs::File, io::Write, path::Path};
use tempfile::tempdir;
use url::Url;

use crate::Hydration;
use crate::{providers::envs, Hydration};

use super::Provider;

Expand Down Expand Up @@ -103,6 +103,7 @@ impl Provider for Infisical {
let child = match Command::new(cmd[0])
.args(&cmd[1..])
.current_dir(temp_dir.path())
.envs(envs())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
Expand Down
6 changes: 5 additions & 1 deletion sdk/src/providers/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::Path;
use std::{collections::HashMap, path::Path};

use anyhow::Result;
use async_trait::async_trait;
Expand Down Expand Up @@ -28,3 +28,7 @@ pub fn providers() -> Vec<Box<dyn Provider + Send>> {
Box::new(raw::Raw::new()),
]
}

pub fn envs() -> HashMap<String, String> {
std::env::vars().collect()
}
3 changes: 2 additions & 1 deletion sdk/src/providers/onepassword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use itertools::Itertools;
use log::debug;
use url::Url;

use crate::Hydration;
use crate::{providers::envs, Hydration};

use super::Provider;

Expand Down Expand Up @@ -63,6 +63,7 @@ impl Provider for OnePassword {

let mut process = Command::new(cmd[0])
.args(&cmd[1..])
.envs(envs())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.stdin(Stdio::piped())
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/providers/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use serde::Deserialize;
use std::{collections::HashMap, path::Path};
use url::Url;

use crate::Hydration;
use crate::{providers::envs, Hydration};

use super::Provider;

Expand Down Expand Up @@ -87,6 +87,7 @@ impl Provider for Vault {

let child = match Command::new(cmd[0])
.args(&cmd[1..])
.envs(envs())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
Expand Down

0 comments on commit 28a48dd

Please sign in to comment.