Crates.io | Multi-env |
lib.rs | Multi-env |
version | 0.0.3 |
source | src |
created_at | 2024-10-20 09:28:57.217805 |
updated_at | 2024-10-21 14:44:59.127806 |
description | An elegant banner library that enhances project launches with eye-catching terminal displays and helpful assistance. |
homepage | |
repository | https://github.com/m1n67un/Multi-env |
max_upload_size | |
id | 1416089 |
size | 27,632 |
This project is an environment variable branching library written in Rust. It helps users easily manage configurations for various environments (development, testing, production, etc.).
https://crates.io/crates/Multi-env
[dependencies]
multi_env = "0.0.3"
use multi_env::set_ok;
use std::env;
fn main() {
// Set the configuration type to "env" (uses .env files)
set_ok("env");
// Set the configuration type to "yml" (uses YAML files with .yml extension)
// set_ok("yml");
// Set the configuration type to "yaml" (uses YAML files with .yaml extension)
// set_ok("yaml");
// USE ENV "RUST.ENV"
env::var("RUST.ENV").unwrap_or_else(|_| String::from(""));
}
In this example, "env" specifies the configuration file format to use. "env" uses .env files, while "yaml" uses YAML files.
cargo run -- -b development
The -b flag specifies the environment (branch) to use. In this example, the "development" environment is used.
For more detailed usage examples, please refer to the examples directory in this repository. It contains sample projects demonstrating various use cases and configurations:
To run an example, navigate to its directory and use:
cargo run -- -b <environment_name>
Replace <environment_name> with the desired environment (e.g., development, production).
Bug reports, feature requests, and pull requests are always welcome!