//! Controller configuration, sourced from CLI flags / environment.
use std::path::PathBuf;
/// Runtime configuration for the controller.
#[derive(Debug, Clone)]
pub struct Config {
/// Directory holding the flat-file desired state (`hosts/*.toml`, `files/`).
pub config_dir: PathBuf,
/// Directory for the iroh blob/doc stores and the persisted namespace id.
pub data_dir: PathBuf,
/// Web UI bind address.
pub bind_address: String,
/// Fixed UDP port for the iroh endpoint. Keeping this stable across restarts
/// keeps the controller's direct address — and thus issued join tickets —
/// valid, so agents reconnect without a fresh ticket.
pub iroh_port: u16,
}
impl Config {
pub fn hosts_dir(&self) -> PathBuf {
self.config_dir.join("hosts")
}
/// Directory holding reusable fragment TOMLs that hosts can `include`.
pub fn include_dir(&self) -> PathBuf {
self.config_dir.join("include")
}
/// File the controller writes its document namespace id to, so the same
/// document (and therefore the same agent join ticket) is reused across
/// restarts.
pub fn namespace_file(&self) -> PathBuf {
self.data_dir.join("namespace")
}
}
neiam
/devendra
public · Issues · Pulls · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
1.2 KiB · text
History
d69022d