From 8dc577c7256df79d7c7047caddeacb39714bc65c Mon Sep 17 00:00:00 2001 From: Stefan Menner Date: Thu, 22 May 2025 19:24:11 +0200 Subject: [PATCH] Update docs --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- README.md | 6 +++++- src/config/env.rs | 4 ++-- src/config/mod.rs | 9 +++++++++ src/config/types.rs | 23 +++++++++++++++++++++++ src/lib.rs | 9 ++++++++- 7 files changed, 50 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c583555..ee6268b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,4 +4,4 @@ version = 4 [[package]] name = "merlin_env_helper" -version = "0.1.0" +version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 37d0f6b..e22c264 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "merlin_env_helper" -version = "0.1.0" +version = "0.2.0" edition = "2024" publish = ["mycargo"] -description = "Utility functions to read environment with fallbak and values from a file" +description = "Utility functions to read environment with fallback and values from a file" license = "MIT" repository = "ssh://git@gitea.merlinserver.de:2222/Stefan/merlin_env_helper.git" [dependencies] diff --git a/README.md b/README.md index 993d4aa..f5d75c2 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# NO Man Sky Wiki +# MERLIN ENV HELPER + +merlin_env_helper + +Helper lib to use environment variables. Like docker with fallback an value maybe in a file. diff --git a/src/config/env.rs b/src/config/env.rs index 958103f..931533e 100644 --- a/src/config/env.rs +++ b/src/config/env.rs @@ -21,8 +21,8 @@ //! # Examples //! //! ```rust -//! use no_man_sky::config::EnvKey; -//! use no_man_sky::config::get_env_value; +//! use merlin_env_helper::config::EnvKey; +//! use merlin_env_helper::config::get_env_value; //! let env_key = EnvKey::key("MY_CONFIG_KEY"); //! match get_env_value(&env_key) { //! Ok(value) => println!("Config value: {}", value), diff --git a/src/config/mod.rs b/src/config/mod.rs index 78cbe2c..731897d 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1,3 +1,12 @@ + +//! This module serves as the configuration layer for the application. +//! +//! It is divided into submodules: +//! - `env`: Handles environment-specific configuration, such as reading +//! environment variables or setting up runtime parameters. +//! - `types`: Defines shared types and structures used for configuration. +//! +//! The module re-exports items from its submodules for easier access. pub mod env; pub mod types; diff --git a/src/config/types.rs b/src/config/types.rs index d4ba541..71c3b78 100644 --- a/src/config/types.rs +++ b/src/config/types.rs @@ -1,3 +1,26 @@ + +/// Represents an environment key with optional secondary key and fallback value. +/// +/// This struct is used to define keys for environment variables, with support for +/// optional secondary keys and fallback values. +/// +/// # Fields +/// - `key`: The primary key as a `String`. +/// - `sec_key`: An optional secondary key as a `String`. +/// - `fallback`: An optional fallback value as a `String`. +/// +/// # Methods +/// - `EnvKey::key(key: &str) -> Self` +/// Creates a new `EnvKey` with the given primary key and no secondary key or fallback value. +/// +/// - `EnvKey::key_with_fallback(key: &str, fallback: &str) -> Self` +/// Creates a new `EnvKey` with the given primary key and fallback value, but no secondary key. +/// +/// - `EnvKey::secure_key(key: &str, sec_key: &str) -> Self` +/// Creates a new `EnvKey` with the given primary key and secondary key, but no fallback value. +/// +/// - `EnvKey::secure_with_fallback(key: &str, sec_key: &str, fallback: &str) -> Self` +/// Creates a new `EnvKey` with the given primary key, secondary key, and fallback value. #[derive(Debug, PartialEq, Eq)] pub struct EnvKey { pub key: String, diff --git a/src/lib.rs b/src/lib.rs index a105933..81652eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,8 @@ -pub mod config; \ No newline at end of file + + +/// This module declaration makes the `config` module public, allowing its items to be accessed +/// from outside the current crate. The `pub use config::*;` statement re-exports all public +/// items from the `config` module, making them directly accessible from the root of the crate. +pub mod config; + +pub use config::*; \ No newline at end of file