Expand description
Layered configuration for siderite applications.
Precedence, lowest to highest: compiled defaults, an optional TOML file,
environment variables, programmatic ConfigBuilder::set overrides.
use siderite_config::ConfigBuilder;
let settings = ConfigBuilder::new()
.set("app.name", "demo")
.build()
.unwrap();
assert_eq!(settings.app.name, "demo");
assert_eq!(settings.server.addr, "127.0.0.1:8000");Modules§
- redact
- The single redaction helper: configuration errors, the configuration explanation and every CLI report use it.
Structs§
- AppSettings
- Application identity and debug flag.
- Cache
Settings - Cache backend settings.
- Config
Builder - Builds
Settingsfrom defaults, files, environment variables, and programmatic overrides. - Config
Entry - One resolved value.
- Config
Source - Where a value came from.
- Database
Settings - Connection settings for one database alias.
- LogSettings
- Tracing subscriber settings.
- Secret
- A value that is never shown by
std::fmt::Debugorstd::fmt::Display. - Server
Settings - HTTP server bind settings.
- Settings
- Complete application settings, produced by
crate::ConfigBuilderorcrate::load.
Enums§
- Config
Error - Failure while loading settings or installing tracing.
- Source
Kind - The kind of source that set a value.
Constants§
- DEFAULT_
APP_ NAME - Default application name.
- DEFAULT_
CACHE_ MAX_ ENTRIES - Default in-memory cache capacity.
- DEFAULT_
CONFIG_ FILE - Optional TOML file consulted by
crate::load. - DEFAULT_
ENV_ PREFIX - Environment prefix used by
crate::load(SIDERITE_APP__NAME, …). - DEFAULT_
LOG_ LEVEL - Default tracing filter when
RUST_LOGis unset. - DEFAULT_
SERVER_ ADDR - Default bind address used when no file, env, or override sets
server.addr.
Functions§
- init_
tracing - Install a
tracing-subscriberusinglog. - is_
secret_ key - Whether a config key may hold a secret. Errs toward redacting: a false positive only hides a value in an error message, a false negative leaks it.
- load
- Load
Settingsfrom optionalsiderite.toml,SIDERITE_environment variables, and theDATABASE_URL/ADDRaliases.