pub struct Config { /* private fields */ }Expand description
The effective configuration of a valid document, with one strongly typed getter per schema field.
Obtained from ConfigDocument::config.
Every value has already passed validation, so the getters cannot fail.
§Examples
use stratum_node_config::{schema, ConfigDocument};
let doc = ConfigDocument::parse(&schema().seed_text())?;
let config = doc.config();
assert_eq!(config.listen_address().port(), 7460);
assert!(config.listen_address().ip().is_loopback());
assert_eq!(config.canonical_origin(), None);
assert_eq!(config.max_body_bytes(), 262_144);Implementations§
Source§impl Config
impl Config
Sourcepub fn canonical_origin(&self) -> Option<&str>
pub fn canonical_origin(&self) -> Option<&str>
Returns node.canonical_origin, or None while it is empty.
Sourcepub fn listen_address(&self) -> SocketAddr
pub fn listen_address(&self) -> SocketAddr
Returns listen.address, which is always a loopback address.
Sourcepub fn backup_dir(&self) -> &Path
pub fn backup_dir(&self) -> &Path
Returns storage.backup_dir, an absolute normalised path distinct from
and not nested with Config::state_dir.
Sourcepub fn age_recipients(&self) -> &[String]
pub fn age_recipients(&self) -> &[String]
Returns backup.age_recipients; each is a structurally valid age
post-quantum hybrid recipient beginning with age1pq1.
Sourcepub fn pod_admin_key_ref(&self) -> Option<&SecretRef>
pub fn pod_admin_key_ref(&self) -> Option<&SecretRef>
Returns secrets.pod_admin_key_ref, or None while it is empty.
Sourcepub fn federation_egress_enabled(&self) -> bool
pub fn federation_egress_enabled(&self) -> bool
Returns federation.egress_enabled.
Sourcepub fn max_body_bytes(&self) -> u32
pub fn max_body_bytes(&self) -> u32
Returns limits.max_body_bytes, in 1024..=1048576.
Sourcepub fn max_outstanding_challenges(&self) -> u32
pub fn max_outstanding_challenges(&self) -> u32
Returns limits.max_outstanding_challenges, in 1..=64.
Trait Implementations§
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Forget for Config
impl Freeze for Config
impl Move for Config
impl RefUnwindSafe for Config
impl Send for Configwhere
RawVecInner: Send,
impl Sync for Configwhere
RawVecInner: Sync,
impl Unpin for Config
impl UnsafeUnpin for Configwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for Configwhere
RawVecInner: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.