Config
riverbase_core::config defines RiverbaseConfig, the single configuration value every process
reads. The Configuration guide covers file discovery and
layering. The Configuration reference lists every key.
Loading
use riverbase_core::config::RiverbaseConfig;
let config = RiverbaseConfig::load()?; // defaults → riverbase.toml → RIVERBASE_* env
With a cfgfetch feature enabled, RiverbaseConfig::load_async().await? can also fetch the document
from a remote source first. RiverbaseApp::init calls load() for you and initializes logging from
the result.
Shape
pub struct RiverbaseConfig {
pub db_url: String,
pub bind_addr: String,
pub log_level: String,
pub log_format: LogFormat, // Compact | Pretty | Json
pub log_http_requests: bool,
pub service_mode: String, // "coupled" | "split"
pub api_base: String, // "/api"
pub api_zone: Vec<String>,
pub audit_log: AuditLogConfig,
pub auth: AuthConfig,
pub bus: BusConfig,
pub casbin: CasbinConfig,
pub link_token: LinkTokenConfig,
pub hook_token: HookTokenConfig,
pub media: MediaStorageConfig,
pub tenant: String,
pub tenant_access_policy: String, // "profile-organization"
pub tenant_stamp_policy: String, // "profile-organization"
pub dbpool_max_size: u32, // 32 (clamped to 1..=128)
pub dbpool_acquire_timeout_secs: u64, // 30
pub dbpool_max_lifetime_secs: u64, // 1800
pub database_statement_timeout_ms: u64, // 60_000
pub query_max_limit: u64, // 500
pub query_count_max_rows: u64, // 10_000
pub deny_unknown_fields: bool,
pub rtc_wire_encoding: String, // "json"
pub request_body_max_bytes: usize, // 256 KiB
pub request_upload_max_bytes: usize, // 20 MiB
// …
}
Sections
| Type | TOML table | Page |
|---|---|---|
AuditLogConfig | [riverbase.audit_log] | Audit log |
AuthConfig | [riverbase.auth] | Authentication |
BusConfig | [riverbase.bus] | Transport |
CasbinConfig | [riverbase.casbin] | Authorization |
MediaStorageConfig | [riverbase.media] | riverbase_file |
LinkTokenConfig, HookTokenConfig | [riverbase.link_token], [riverbase.hook_token] | HTTP conventions |
Formats
riverbase_core::cfgfmt parses the HCL and YAML (with the yaml feature) spec documents that
extension crates use. ConfigFormat::from_path picks the format by extension, and
parse_hcl_to_json turns HCL into serde_json::Value. Service configuration itself is TOML.
Remote fetch
| Feature | Source |
|---|---|
cfgfetch-https | https://…, with RIVERBASE_CONFIG_HTTP_TOKEN |
cfgfetch-git | A git remote, with RIVERBASE_CONFIG_GIT_TOKEN and RIVERBASE_CONFIG_GIT_RAW_TEMPLATE |
cfgfetch-s3 | An S3 object (AWS credentials from the environment) |
cfgfetch-oci | An OCI artifact (ECR, GCR), with RIVERBASE_CONFIG_OCI_TOKEN |
Point RIVERBASE_CONFIG_URI at the document and set RIVERBASE_CONFIG_FORMAT if the extension is
ambiguous. With RIVERBASE_CONFIG_SOPS, the fetched document is SOPS-decrypted in memory and never
written to disk.