pub struct GovernanceConfig {
pub enabled: bool,
pub policies: Vec<PolicyConfig>,
}Expand description
The ordered policy chain declaration.
Fields§
§enabled: boolgovernance.enabled: false switches the whole chain off in one key,
leaving the per-policy declarations below intact so the configuration
survives being turned back on.
policies: Vec<PolicyConfig>Implementations§
Source§impl GovernanceConfig
impl GovernanceConfig
Sourcepub fn defaults() -> Self
pub fn defaults() -> Self
The four built-in policies, enabled, with default parameters, in first-deny-wins order: cheap-and-fatal checks before stateful ones.
Sourcepub fn parse(yaml: &str) -> Result<Self, GovernanceConfigError>
pub fn parse(yaml: &str) -> Result<Self, GovernanceConfigError>
Strict parse of a YAML document.
Sourcepub fn validate(path: &Path) -> Result<(), GovernanceConfigError>
pub fn validate(path: &Path) -> Result<(), GovernanceConfigError>
Boot-time check, for callers that can still refuse to start.
Why: Self::load cannot fail, so a typo in the policy chain reaches
the runtime as silently-restored defaults — which for governance means
more enforcement than was asked for, and for an operator who edited
the file to relax a policy, the exact opposite of their intent. Calling
this once during startup converts that into a refusal to boot, while
leaving the request path unable to die on a config read.
Sourcepub fn load(path: &Path) -> Self
pub fn load(path: &Path) -> Self
Lenient load for the request path: every failure falls back to
Self::defaults and logs, because a governance deployment that
failed closed on a config typo would block every tool call in the
installation. Pair with Self::validate at startup to catch the typo
before it gets this far.
Trait Implementations§
Source§impl Clone for GovernanceConfig
impl Clone for GovernanceConfig
Source§fn clone(&self) -> GovernanceConfig
fn clone(&self) -> GovernanceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for GovernanceConfig
impl RefUnwindSafe for GovernanceConfig
impl Send for GovernanceConfig
impl Sync for GovernanceConfig
impl Unpin for GovernanceConfig
impl UnsafeUnpin for GovernanceConfig
impl UnwindSafe for GovernanceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more