Update docs
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -4,4 +4,4 @@ version = 4
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "merlin_env_helper"
|
name = "merlin_env_helper"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "merlin_env_helper"
|
name = "merlin_env_helper"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
publish = ["mycargo"]
|
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"
|
license = "MIT"
|
||||||
repository = "ssh://git@gitea.merlinserver.de:2222/Stefan/merlin_env_helper.git"
|
repository = "ssh://git@gitea.merlinserver.de:2222/Stefan/merlin_env_helper.git"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
//! # Examples
|
//! # Examples
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use no_man_sky::config::EnvKey;
|
//! use merlin_env_helper::config::EnvKey;
|
||||||
//! use no_man_sky::config::get_env_value;
|
//! use merlin_env_helper::config::get_env_value;
|
||||||
//! let env_key = EnvKey::key("MY_CONFIG_KEY");
|
//! let env_key = EnvKey::key("MY_CONFIG_KEY");
|
||||||
//! match get_env_value(&env_key) {
|
//! match get_env_value(&env_key) {
|
||||||
//! Ok(value) => println!("Config value: {}", value),
|
//! Ok(value) => println!("Config value: {}", value),
|
||||||
|
|||||||
@@ -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 env;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
|
|
||||||
|
|||||||
@@ -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)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub struct EnvKey {
|
pub struct EnvKey {
|
||||||
pub key: String,
|
pub key: String,
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
pub mod config;
|
|
||||||
|
|
||||||
|
/// 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::*;
|
||||||
Reference in New Issue
Block a user