diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 3ee6a13643..2159be97b6 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -94,4 +94,5 @@ sqlx = { version = "0.5", features = [ ] } [features] +default = ["wireguard"] wireguard = ["nym-wireguard"] diff --git a/gateway/src/node/mod.rs b/gateway/src/node/mod.rs index d3764c635a..70fef57868 100644 --- a/gateway/src/node/mod.rs +++ b/gateway/src/node/mod.rs @@ -520,15 +520,21 @@ impl Gateway { Arc::new(coconut_verifier), ); - // Once this is a bit more mature, make this a commandline flag instead of a compile time - // flag #[cfg(feature = "wireguard")] - if let Err(err) = self - .start_wireguard(shutdown.subscribe().named("wireguard")) - .await { - // that's a nasty workaround, but anyhow errors are generally nicer, especially on exit - bail!("{err}") + let wireguard_enabled = std::env::var("NYM_ENABLE_WIREGUARD") + .map(|v| v == "1") + .unwrap_or(false); + + if wireguard_enabled { + if let Err(err) = self + .start_wireguard(shutdown.subscribe().named("wireguard")) + .await + { + // that's a nasty workaround, but anyhow errors are generally nicer, especially on exit + bail!("{err}") + } + } } info!("Finished nym gateway startup procedure - it should now be able to receive mix and client traffic!");