diff --git a/CHANGELOG.md b/CHANGELOG.md index 68d6667d3..76b768dc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Drop unused SQL columns #4141 - "full message view" not needed because of footers that go to contact status #4151 - Pick up system's light/dark mode in generated message HTML #4150 +- Support non-persistent configuration with DELTACHAT_* env ### Fixes - Fix segmentation fault if `dc_context_unref()` is called during diff --git a/src/config.rs b/src/config.rs index 2fa64ae96..39cd00877 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,5 +1,6 @@ //! # Key-value configuration management. +use std::env; use std::str::FromStr; use anyhow::{ensure, Context as _, Result}; @@ -317,6 +318,11 @@ impl Context { /// Get a configuration key. Returns `None` if no value is set, and no default value found. pub async fn get_config(&self, key: Config) -> Result> { + let env_key = format!("DELTACHAT_{}", key.as_ref().to_uppercase()); + if let Ok(value) = env::var(env_key) { + return Ok(Some(value)); + } + let value = match key { Config::Selfavatar => { let rel_path = self.sql.get_raw_config(key.as_ref()).await?;