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.
The field is reserved: a Stratum node generates its pod administration key itself and does not read this reference.
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.
Sourcepub fn max_tenants(&self) -> u32
pub fn max_tenants(&self) -> u32
Returns membership.max_tenants, in 1..=10000.
Sourcepub fn invitations_enabled(&self) -> bool
pub fn invitations_enabled(&self) -> bool
Returns membership.invitations_enabled.
Sourcepub fn invitation_ttl_secs(&self) -> u32
pub fn invitation_ttl_secs(&self) -> u32
Returns membership.invitation_ttl_secs, in 60..=2592000.
Sourcepub fn max_pod_body_bytes(&self) -> u32
pub fn max_pod_body_bytes(&self) -> u32
Returns limits.max_pod_body_bytes, in 1024..=1073741824.
Sourcepub fn admission_requests_per_minute(&self) -> u32
pub fn admission_requests_per_minute(&self) -> u32
Returns limits.admission_requests_per_minute, in 1..=6000.
Sourcepub fn min_pod_free_bytes(&self) -> u64
pub fn min_pod_free_bytes(&self) -> u64
Returns limits.min_pod_free_bytes; zero means the check is off.
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
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
key and return true if they are equal.