Skip to main content

Crate siderite_config

Crate siderite_config 

Source
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.
CacheSettings
Cache backend settings.
ConfigBuilder
Builds Settings from defaults, files, environment variables, and programmatic overrides.
ConfigEntry
One resolved value.
ConfigSource
Where a value came from.
DatabaseSettings
Connection settings for one database alias.
LogSettings
Tracing subscriber settings.
Secret
A value that is never shown by std::fmt::Debug or std::fmt::Display.
ServerSettings
HTTP server bind settings.
Settings
Complete application settings, produced by crate::ConfigBuilder or crate::load.

Enums§

ConfigError
Failure while loading settings or installing tracing.
SourceKind
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_LOG is unset.
DEFAULT_SERVER_ADDR
Default bind address used when no file, env, or override sets server.addr.

Functions§

init_tracing
Install a tracing-subscriber using log.
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 Settings from optional siderite.toml, SIDERITE_ environment variables, and the DATABASE_URL / ADDR aliases.