diff --git a/book/src/proxy/README.md b/book/src/proxy/README.md index edc643e..5bf0b5e 100644 --- a/book/src/proxy/README.md +++ b/book/src/proxy/README.md @@ -27,6 +27,7 @@ Add the following configuration to the `haze.toml` configuration file: address = "haze.example.com" # the base domain for the proxy to use listen = "127.0.0.1:8080" # the port+ip to listen on # listen = "/var/run/haze/haze.sock" # or a unix socket path +# tray = true # show a system tray item, defaults to false ``` ### Without a reverse proxy diff --git a/src/config.rs b/src/config.rs index 64e140d..fc7dac5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,8 +7,8 @@ use std::convert::TryFrom; use std::env::home_dir; use std::fs::read_to_string; use std::net::IpAddr; -use toml::map::Map; use toml::Value; +use toml::map::Map; #[derive(Debug, Deserialize, Default)] #[serde(from = "RawHazeConfig")] @@ -205,6 +205,8 @@ pub struct ProxyConfig { pub cert: Option, #[serde(default)] pub key: Option, + #[serde(default)] + pub tray: bool, } impl ProxyConfig { diff --git a/src/proxy.rs b/src/proxy.rs index aebcc3b..c412d1a 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -167,7 +167,11 @@ pub async fn proxy(docker: Docker, config: HazeConfig) -> Result<()> { let shutdown = Arc::new(Notify::new()); #[cfg(feature = "tray")] - let tray = crate::tray::spawn_tray(docker.clone(), config.clone(), shutdown.clone()).await; + let tray = if config.proxy.tray { + crate::tray::spawn_tray(docker.clone(), config.clone(), shutdown.clone()).await + } else { + None + }; let instances = ActiveInstances::new(docker, config); let result = serve(instances, listen, base_address, acceptor, shutdown).await;