aiondb-config

Runtime configuration model used by every server entry point. Defines the typed RuntimeConfig tree (storage, pgwire, security, limits, replication, HA, distributed, sharding) and the loaders that populate it from AIONDB_* environment variables or a KEY=VALUE config file. All fallible operations return aiondb_core::DbResult<T>.

cargo

[dependencies]
aiondb-config = { path = "../aiondb-config" }

modules

modulepurpose
envHelpers around std::env::var (env_string, env_u16, env_bool, env_optional_string).
haHigh-availability and failover settings (HaConfig).
loaderload_from_env and load_from_file plus validation.
pgwirePgwire listener and TLS settings (PgWireConfig, TlsMode).
productPublic product contract metadata (ProductConstraints, ProductSupportLevel).
replicationWAL streaming settings (ReplicationConfig, ReplicationRole, WriteConcern, WalCompression, WalLsnMode).
runtimeTop-level RuntimeConfig, LimitsConfig, EnginePoolConfig, DistributedConfig, RemoteNodeConfig, RemoteSnapshotMode.
securitySecurity profile and password/lockout policy (SecurityConfig, SecurityProfile).
storageStorage backend selection and pool sizing (StorageConfig, StorageBackend, DurableWalCommitPolicy).
systotal_system_memory() for auto-tuning on Linux.

key types

loading

load_from_env reads AIONDB_* keys from the process environment. load_from_file(path) reads the same keys from a KEY=VALUE file (lines starting with # are comments). Both call the same validation pass and return DbResult<RuntimeConfig>. Setting AIONDB_CONFIG_STRICT=true makes unknown AIONDB_* keys fail loading; otherwise unknown keys are logged at warn and ignored.

example

use aiondb_config::{
    load_from_env, RuntimeConfig, SecurityProfile, StorageBackend, TlsMode,
};

let config: RuntimeConfig = load_from_env().expect("config from env");

assert_eq!(config.storage.backend, StorageBackend::Durable);
assert_eq!(config.security.profile, SecurityProfile::Development);
assert!(matches!(
    config.pgwire.tls_mode,
    TlsMode::Disable | TlsMode::Prefer | TlsMode::Require
));

Building a config in-process without env vars uses Default:

use aiondb_config::{RuntimeConfig, ReplicationRole};

let mut config = RuntimeConfig::default();
config.replication.role = ReplicationRole::Standalone;
config.pgwire.max_connections = 64;

product constraints

use aiondb_config::{ProductSupportLevel, V0_1_PRODUCT_CONSTRAINTS};

assert_eq!(V0_1_PRODUCT_CONSTRAINTS.release_line, "0.1");
assert_eq!(V0_1_PRODUCT_CONSTRAINTS.topology, "single-node");
assert_eq!(
    V0_1_PRODUCT_CONSTRAINTS.clustering,
    ProductSupportLevel::Unsupported
);