#[non_exhaustive]pub struct DaemonConfig {
pub daemon: DaemonSection,
pub whistle: WhistleSection,
pub style: StyleSection,
pub interpreters: BTreeMap<String, String>,
pub dog: BTreeMap<String, Table>,
}Expand description
Parsed daemon configuration with raw per-dog sections.
Dog sections stay untyped here: each dog deserializes its own
[dog.<name>] table, so dog config schemas live with the dog code.
#[non_exhaustive] guards against a breaking struct literal as this
type grows sections, but is not a validation gate: its pub fields
can still be mutated after Self::load/Self::load_layered
validate, and shep-core cannot detect that.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.daemon: DaemonSectionThe [daemon] section
whistle: WhistleSectionThe [whistle] section
style: StyleSectionThe [style] section
interpreters: BTreeMap<String, String>The [interpreters] section: a script extension (no leading dot,
"js" not ".js") mapped to the interpreter that runs it.
Read by the CLI only, before a request reaches the wire: target
resolution folds a match into an app’s own
AppConfig::interpreter
only when that field is unset, and --interpreter on the command
line outranks both. The daemon itself never reads this field.
Declared here, like StyleSection, so RawDaemonConfig’s
deny_unknown_fields does not turn an unrecognized [interpreters]
section into a hard parse error on every boot.
dog: BTreeMap<String, Table>Raw [dog.<name>] sections keyed by dog name
Implementations§
Source§impl DaemonConfig
impl DaemonConfig
Sourcepub fn load(
file_source: Option<&str>,
env: &dyn Fn(&str) -> Option<String>,
) -> Result<Self, DaemonConfigError>
pub fn load( file_source: Option<&str>, env: &dyn Fn(&str) -> Option<String>, ) -> Result<Self, DaemonConfigError>
Builds config from optional file source + environment overrides.
file < env, validated. Equivalent to Self::load_layered with
an empty DaemonOverrides.
§Errors
DaemonConfigError::Toml: the file source is invalid TOML.DaemonConfigError::BadEnvValue: aSHEP_*value is not parseable.DaemonConfigError::BelowMinimum: the effectivemax_cron_sleepis below the floor.
Sourcepub fn load_layered(
file_source: Option<&str>,
env: &dyn Fn(&str) -> Option<String>,
overrides: &DaemonOverrides,
) -> Result<Self, DaemonConfigError>
pub fn load_layered( file_source: Option<&str>, env: &dyn Fn(&str) -> Option<String>, overrides: &DaemonOverrides, ) -> Result<Self, DaemonConfigError>
Builds config from optional file source + environment + CLI-flag overrides.
file < env < flags (spec §5), validated exactly once, at the end,
so a later layer can rescue a value an earlier one would reject.
§Errors
DaemonConfigError::Toml: the file source is invalid TOML.DaemonConfigError::BadEnvValue: aSHEP_*value is not parseable.DaemonConfigError::BelowMinimum: the effectivemax_cron_sleepis below the floor.
Trait Implementations§
Source§impl Clone for DaemonConfig
impl Clone for DaemonConfig
Source§fn clone(&self) -> DaemonConfig
fn clone(&self) -> DaemonConfig
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 DaemonConfig
Redacts dog: only the table count is printed.
impl Debug for DaemonConfig
Redacts dog: only the table count is printed.