Skip to main content

Module env_compat

Module env_compat 

Source
Available on crate feature config only.
Expand description

Environment variable compatibility layer.

Reads env vars supporting legacy name aliases (PG*, KAFKA_, VAULT_, AWS_*) with deprecation warnings for graceful migration.

Resolution: standard name first, then legacy names; a legacy hit logs a deprecation warning. Standard always wins 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, for debugging which variables are set.