Crate env_inventory
source ·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.
Macros
- Registers one or more environment variables for tracking and validation.
Enums
- Represents the potential errors that can be encountered by the
env-inventorymodule.
Functions
- List all the registered environment variables. that are expected from different parts of the application.
- Loads environment variables from specified configuration files and validates their presence.
- Validates that all registered environment variables are set.