mirror of
https://codeberg.org/icewind/haze.git
synced 2026-11-30 04:30:47 +01:00
make tray icon configurable, disabled by default
This commit is contained in:
parent
9401a3dc7e
commit
2de025694f
3 changed files with 9 additions and 2 deletions
|
|
@ -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
|
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 = "127.0.0.1:8080" # the port+ip to listen on
|
||||||
# listen = "/var/run/haze/haze.sock" # or a unix socket path
|
# 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
|
### Without a reverse proxy
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ use std::convert::TryFrom;
|
||||||
use std::env::home_dir;
|
use std::env::home_dir;
|
||||||
use std::fs::read_to_string;
|
use std::fs::read_to_string;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
use toml::map::Map;
|
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
|
use toml::map::Map;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Default)]
|
#[derive(Debug, Deserialize, Default)]
|
||||||
#[serde(from = "RawHazeConfig")]
|
#[serde(from = "RawHazeConfig")]
|
||||||
|
|
@ -205,6 +205,8 @@ pub struct ProxyConfig {
|
||||||
pub cert: Option<String>,
|
pub cert: Option<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub key: Option<String>,
|
pub key: Option<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub tray: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProxyConfig {
|
impl ProxyConfig {
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,11 @@ pub async fn proxy(docker: Docker, config: HazeConfig) -> Result<()> {
|
||||||
let shutdown = Arc::new(Notify::new());
|
let shutdown = Arc::new(Notify::new());
|
||||||
|
|
||||||
#[cfg(feature = "tray")]
|
#[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 instances = ActiveInstances::new(docker, config);
|
||||||
let result = serve(instances, listen, base_address, acceptor, shutdown).await;
|
let result = serve(instances, listen, base_address, acceptor, shutdown).await;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue