Skip to main content

lightshuttle_secrets/source/
mod.rs

1//! Secret source trait and built-in implementations.
2
3mod env_file;
4
5pub use env_file::EnvFileSource;
6
7use std::collections::HashMap;
8
9use crate::error::SecretError;
10
11/// A source of key-value secret pairs.
12///
13/// Implementations may read from a file, the system environment, a remote
14/// vault, or any other backing store. Each call to [`load`] returns a fresh
15/// snapshot; sources are expected to be cheap to call repeatedly.
16///
17/// [`load`]: SecretSource::load
18pub trait SecretSource: Send + Sync {
19    /// Load all secrets from this source.
20    ///
21    /// Returns a map of variable names to their string values.
22    fn load(&self) -> Result<HashMap<String, String>, SecretError>;
23
24    /// Human-readable name used in error messages and diagnostics.
25    fn source_name(&self) -> &str;
26}