solid_pod_rs/config/mod.rs
1//! # JSS-compatible server config
2//!
3//! PRD §F6 / Sprint 4 — bounded context
4//! [`docs/design/jss-parity/05-config-platform-context.md`].
5//!
6//! This module provides a layered config loader that mirrors JSS's
7//! three-layer model (CLI > env > file > default; the CLI overlay
8//! lives in the consumer binary) so that **the same JSS
9//! `config.json` file boots both servers** once F7 ships the
10//! `solid-pod-rs-server` binary.
11//!
12//! ## Layout
13//!
14//! - [`schema`] — [`ServerConfig`] aggregate + value objects.
15//! - [`loader`] — [`ConfigLoader`] builder for layered loads.
16//! - [`sources`] — [`ConfigSource`] + env/file/defaults resolvers.
17//!
18//! ## Typical use
19//!
20//! ```no_run
21//! use solid_pod_rs::config::ConfigLoader;
22//!
23//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
24//! let cfg = ConfigLoader::new()
25//! .with_defaults() // lowest precedence
26//! .with_file("/etc/solid-pod-rs.json")
27//! .with_env() // highest precedence
28//! .load()
29//! .await?;
30//!
31//! println!("listening on {}:{}", cfg.server.host, cfg.server.port);
32//! # Ok(()) }
33//! ```
34//!
35//! ## JSS env var parity
36//!
37//! See [`sources`] for the full mapping table. Headline vars:
38//!
39//! - `JSS_HOST`, `JSS_PORT`, `JSS_BASE_URL`
40//! - `JSS_ROOT`, `JSS_STORAGE_TYPE`, `JSS_STORAGE_ROOT`
41//! - `JSS_OIDC_ENABLED`, `JSS_OIDC_ISSUER` (+ `JSS_IDP`, `JSS_IDP_ISSUER` aliases)
42//! - `JSS_NOTIFICATIONS`, `JSS_NOTIFICATIONS_{WS2023,WEBHOOK,LEGACY}`
43//! - `JSS_SSRF_ALLOW_PRIVATE`, `JSS_SSRF_{ALLOW,DENY}LIST`
44//! - `JSS_DOTFILE_ALLOWLIST`, `JSS_ACL_ORIGIN_ENABLED`
45//!
46//! Unknown `JSS_*` vars are ignored (forward-compat with newer JSS).
47
48pub mod loader;
49pub mod schema;
50pub mod sources;
51
52pub use loader::{CliArgs, ConfigLoader};
53pub use schema::{
54 AuthConfig, ExtrasConfig, NotificationsConfig, SecurityConfig, ServerConfig, ServerSection,
55 StorageBackendConfig,
56};
57pub use sources::ConfigSource;