We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent baadf5a commit 00635d5Copy full SHA for 00635d5
1 file changed
src/config.rs
@@ -35,7 +35,7 @@ impl Config {
35
/// Initialize global config from environment variables (call once at startup).
36
/// Can be called multiple times - subsequent calls are no-ops.
37
pub fn init() {
38
- let mut config = CONFIG.lock().unwrap();
+ let mut config = CONFIG.lock().unwrap_or_else(|e| e.into_inner());
39
if config.is_none() {
40
*config = Some(Self::from_env());
41
}
@@ -55,7 +55,7 @@ impl Config {
55
/// Allows tests to reinitialize config with different env vars.
56
#[cfg(test)]
57
pub fn reset() {
58
- *CONFIG.lock().unwrap() = None;
+ *CONFIG.lock().unwrap_or_else(|e| e.into_inner()) = None;
59
60
61
/// Load configuration from environment variables
0 commit comments