Expand description
Environment variable compatibility layer.
Provides utilities for reading environment variables with support for:
- Legacy variable name aliases with deprecation warnings
- Standard naming conventions (PG*, KAFKA_, VAULT_, AWS_*)
- Graceful migration from old to new variable names
§How it works
When reading an environment variable:
- First try the standard (preferred) name
- If not set, try legacy (deprecated) names
- If a legacy name is used, log a deprecation warning
- Standard name always takes precedence if both are set
§Example
ⓘ
use hyperi_rustlib::config::env_compat::EnvVar;
// Define a variable with legacy aliases
let host = EnvVar::new("PGHOST")
.with_legacy("POSTGRESQL_HOST")
.with_legacy("PG_HOST")
.get();
// Or use the builder for multiple variables
let vars = EnvVarSet::new("KAFKA")
.var("BOOTSTRAP_SERVERS", &["BROKERS"])
.var("SASL_USERNAME", &["SASL_USER"])
.build();Modules§
- aws
- AWS environment variables (official SDK naming).
- clickhouse
- ClickHouse environment variables.
- kafka
- Kafka environment variables.
- postgres
- PostgreSQL environment variables (libpq standard).
- vault
- Vault/OpenBao environment variables.
Structs§
- EnvVar
- Environment variable with optional legacy aliases.
Functions§
- load_
all_ standard - Load all standard environment variables into a HashMap.