Skip to content

Commit

Permalink
Replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
Razz4780 committed Feb 5, 2025
1 parent 1429a36 commit 5f85c27
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 39 deletions.
34 changes: 8 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ streammap-ext = "0.1"
regex = { version = "1", features = ["unicode-case"] }
fancy-regex = { version = "0.14" }
enum_dispatch = "0.3"
envfile = "0.2"

dotenv = "0.15"

# If you update `hyper`, check that `h2` version is compatible in `intproxy/Cargo.toml`.
# There is a test for this: `cargo test -p mirrord-intproxy hyper_and_h2_versions_in_sync`
Expand Down
2 changes: 1 addition & 1 deletion mirrord/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mirrord-vpn = { path = "../vpn" }

actix-codec.workspace = true
clap.workspace = true
envfile.workspace = true
dotenv.workspace = true
tracing.workspace = true
serde_json.workspace = true
serde.workspace = true
Expand Down
5 changes: 3 additions & 2 deletions mirrord/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ impl ExecParams {
if let Some(env_file) = &self.env_file {
// Set canonicalized path to env file, in case forks/children are in different
// working directories.
let full_path = std::fs::canonicalize(env_file)
.map_err(|e| CliError::EnvFileAccessError(env_file.clone(), e))?;
let full_path = std::fs::canonicalize(env_file).map_err(|e| {
CliError::EnvFileAccessError(env_file.clone(), dotenv::Error::Io(e))
})?;
envs.insert(
MIRRORD_OVERRIDE_ENV_FILE_ENV.into(),
full_path.as_os_str().to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion mirrord/cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub(crate) enum CliError {

#[error("Failed to access env file at `{0}`: {1}")]
#[diagnostic(help("Please check that the path is correct and that you have permissions to read it.{GENERAL_HELP}"))]
EnvFileAccessError(PathBuf, std::io::Error),
EnvFileAccessError(PathBuf, dotenv::Error),

#[cfg(target_os = "macos")]
#[error("SIP Error: `{0:#?}`")]
Expand Down
8 changes: 5 additions & 3 deletions mirrord/cli/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,11 @@ impl MirrordExecution {
};

if let Some(file) = &config.feature.env.env_file {
let envs_from_file = envfile::EnvFile::new(file)
.map_err(|error| CliError::EnvFileAccessError(file.clone(), error))?
.store;
#[allow(deprecated)]
let envs_from_file = dotenv::from_path_iter(file)
.and_then(|iter| iter.collect::<Result<Vec<_>, _>>())
.map_err(|error| CliError::EnvFileAccessError(file.clone(), error))?;

env_vars.extend(envs_from_file);
}

Expand Down
2 changes: 1 addition & 1 deletion mirrord/layer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ base64.workspace = true
bincode.workspace = true
bytemuck = "1"
ctor = "0.2"
envfile.workspace = true
dotenv.workspace = true
errno = "0.3"
frida-gum = { version = "0.15", features = ["auto-download"] }
hashbrown = "0.15"
Expand Down
8 changes: 5 additions & 3 deletions mirrord/layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,11 @@ fn fetch_env_vars() -> HashMap<String, String> {
.unwrap_or_default();

if let Some(file) = &setup().env_config().env_file {
let envs_from_file = envfile::EnvFile::new(file)
.expect("failed to access env file")
.store;
#[allow(deprecated)]
let envs_from_file = dotenv::from_path_iter(file)
.and_then(|iter| iter.collect::<Result<Vec<_>, _>>())
.expect("failed to access the env file");

env_vars.extend(envs_from_file);
}

Expand Down

0 comments on commit 5f85c27

Please sign in to comment.