brokerd: config, [gateway] socket for Mattermost approvals
This commit is contained in:
@@ -45,6 +45,14 @@ impl Default for Approvals {
|
||||
}
|
||||
}
|
||||
|
||||
/// `[gateway]`: where `gatewayd` takes approvals to post in Mattermost. Without the section,
|
||||
/// Mattermost approvals are off and only `bxctl` answers. An empty path means the default.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Default)]
|
||||
#[serde(deny_unknown_fields, default)]
|
||||
pub struct Gateway {
|
||||
pub socket: PathBuf,
|
||||
}
|
||||
|
||||
fn default_podman() -> PathBuf {
|
||||
PathBuf::from("podman")
|
||||
}
|
||||
@@ -129,6 +137,8 @@ pub struct Config {
|
||||
pub approvals: Approvals,
|
||||
#[serde(default)]
|
||||
pub runner: Option<Runner>,
|
||||
#[serde(default)]
|
||||
pub gateway: Option<Gateway>,
|
||||
}
|
||||
|
||||
/// The longest an approval may wait: a day, the longest `loopd` waits after a pending frame.
|
||||
@@ -262,6 +272,15 @@ impl Config {
|
||||
self.sockets.admin.clone()
|
||||
}
|
||||
}
|
||||
/// `gateway.sock`, when `[gateway]` is set.
|
||||
pub fn gateway_socket(&self) -> Option<PathBuf> {
|
||||
let gateway = self.gateway.as_ref()?;
|
||||
if gateway.socket.as_os_str().is_empty() {
|
||||
Some(self.paths.home.join("run/gateway/gateway.sock"))
|
||||
} else {
|
||||
Some(gateway.socket.clone())
|
||||
}
|
||||
}
|
||||
pub fn audit_dir(&self) -> PathBuf {
|
||||
self.paths.home.join("audit")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user