pub struct RouterConfig {
pub sources: Vec<SourceDefinition>,
pub default: Option<DefaultRoute>,
pub routes: Vec<RouteRule>,
pub secret_overrides: BTreeMap<SecretPath, SecretOverride>,
}Expand description
Parsed + validated router configuration.
Built by RouterConfig::load / RouterConfig::parse. The
router (P5.3) consumes the typed view; doctor (P7.2) reports
on it.
Fields§
§sources: Vec<SourceDefinition>All [[source]] blocks in declaration order.
default: Option<DefaultRoute>[default], if present. Optional because a config may
declare only routes / per-secret overrides and leave the
default unset (in which case unmatched paths fail with a
“no route” error at resolution time).
routes: Vec<RouteRule>All [[route]] blocks in declaration order. The router
picks the longest matching prefix at resolution time.
secret_overrides: BTreeMap<SecretPath, SecretOverride>All [secret."<path>"] blocks. Ordered by path for stable
iteration in doctor output and tests.
Implementations§
Source§impl RouterConfig
impl RouterConfig
Sourcepub fn default_path() -> Result<PathBuf, RouterConfigError>
pub fn default_path() -> Result<PathBuf, RouterConfigError>
Resolve the canonical on-disk path
(<config_dir>/devboy-tools/secrets/sources.toml).
Sourcepub fn load() -> Result<Self, RouterConfigError>
pub fn load() -> Result<Self, RouterConfigError>
Load the config from the canonical default path. Returns an empty (no-sources) config if the file does not exist — the router config is opt-in.
Sourcepub fn load_from(path: &Path) -> Result<Self, RouterConfigError>
pub fn load_from(path: &Path) -> Result<Self, RouterConfigError>
Load from a specific path. Returns an empty config if the file does not exist; otherwise reads, parses, and validates.
Sourcepub fn parse(toml_body: &str) -> Result<Self, RouterConfigError>
pub fn parse(toml_body: &str) -> Result<Self, RouterConfigError>
Parse + validate from an in-memory TOML string. Path-aware
errors that expose a PathBuf (Read, Parse) carry a
placeholder <inline> from this entry point — use
Self::load_from when you want them to point at the real
file.
Trait Implementations§
Source§impl Clone for RouterConfig
impl Clone for RouterConfig
Source§fn clone(&self) -> RouterConfig
fn clone(&self) -> RouterConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouterConfig
impl Debug for RouterConfig
Source§impl Default for RouterConfig
impl Default for RouterConfig
Source§fn default() -> RouterConfig
fn default() -> RouterConfig
Source§impl PartialEq for RouterConfig
impl PartialEq for RouterConfig
Source§fn eq(&self, other: &RouterConfig) -> bool
fn eq(&self, other: &RouterConfig) -> bool
self and other values to be equal, and is used by ==.