Expand description
env-inventory
: A Unified Environment Variable Management Crate
This crate provides utilities for easily registering and managing environment variables within your Rust applications. This ensures a centralized approach to handling environment configurations, offering a consistent method of accessing parameters from the environment.
Features:
- Unified Access: Access environment parameters uniformly from anywhere in the code.
- TOML Integration: Allows loading of parameters from TOML configuration files.
- Precedence Handling: Parameters loaded merge with environment variables, where the latter takes precedence.
- Registration System: Variables of interest are registered via the provided macros, ensuring that you only focus on the ones you need.
Usage involves registering variables using the provided macros, and then employing the provided utilities to load and validate these variables either from the environment or TOML files.
Note: dotenv
file support isn’t available currently.
Note: This crate is still in its early stages and is subject to change.
Note: shell-expansions
(probably using
https://docs.rs/shellexpand/latest/shellexpand/fn.tilde.html)
coming soon.
Re-exports§
pub extern crate inventory;
Macros§
- register
- Registers one or more environment variables for tracking and validation.
Enums§
- EnvInventory
Error - Represents the potential errors that can be encountered by the
env-inventory
module.
Functions§
- dump_
all_ vars - Dump all the registered environment variables.
- expanded_
map - Expand all the registered environment variables. that are expected from different parts of the application. So for instance if you have a variable like this:
- list_
all_ vars - List all the registered environment variables. that are expected from different parts of the application.
- load_
and_ validate_ env_ vars - Loads environment variables from specified configuration files and validates their presence.
- validate_
env_ vars - Validates that all registered environment variables are set.