nostr_bbs_config/lib.rs
1//! Operator-supplied TOML configuration kit for nostr-bbs deployments.
2//!
3//! Implements [PRD-012 §5 X1] and [ADR-085]: a single `forum.toml` file is the
4//! source of truth for every deployment-specific setting (branding, hostnames,
5//! rate limits, custody tier, federation peers, ...). Worker crates in the
6//! `nostr-bbs-*-worker` set load this at startup; the `forum-client` reads its
7//! shape via `option_env!` slots populated at build time.
8//!
9//! # Example
10//!
11//! ```no_run
12//! use nostr_bbs_config::ForumConfig;
13//!
14//! let toml = std::fs::read_to_string("forum.toml").unwrap();
15//! let config: ForumConfig = nostr_bbs_config::load_from_str(&toml).unwrap();
16//! assert!(!config.deployment.hostname.as_str().is_empty());
17//! ```
18//!
19//! # Modules
20//!
21//! - [`schema`] — strongly-typed TOML schema (one struct per `[section]`).
22//! - [`loader`] — `load_from_str` / `load_from_path` entry points.
23//! - [`validate`] — semantic checks beyond serde (e.g. URL formats, port ranges).
24//!
25//! # Stability
26//!
27//! Schema additions are minor-version compatible (new optional fields behind
28//! `#[serde(default)]`). Schema removals or type changes are breaking and bump
29//! the major version of this crate.
30//!
31//! [PRD-012 §5 X1]: https://github.com/DreamLab-AI/nostr-rust-forum/blob/main/docs/PRD-012.md
32//! [ADR-085]: https://github.com/DreamLab-AI/nostr-rust-forum/blob/main/docs/adr/ADR-085.md
33
34#![warn(missing_docs)]
35
36pub mod loader;
37pub mod schema;
38pub mod validate;
39
40pub use loader::{load_from_path, load_from_str, ConfigError};
41pub use schema::ForumConfig;