feat: DEFAULT_LANGUAGE/DEFAULT_TIMEZONE config + public GET /api/config

This commit is contained in:
2026-06-05 14:52:09 +02:00
parent 4a76d6043a
commit 2460a1368d
16 changed files with 161 additions and 1 deletions
+17
View File
@@ -50,4 +50,21 @@ pub struct Config {
default_value_t = 5
)]
pub db_max_connections: u32,
/// Default UI + content-authoring language for this instance (i18n key, e.g. "sv").
#[arg(
long = "default-language",
env = "DEFAULT_LANGUAGE",
default_value = "sv"
)]
pub default_language: String,
/// Default display timezone (IANA name, e.g. "Europe/Stockholm"). Storage stays UTC;
/// this is a display hint surfaced to clients (and, later, server-side renderers).
#[arg(
long = "default-timezone",
env = "DEFAULT_TIMEZONE",
default_value = "Europe/Stockholm"
)]
pub default_timezone: String,
}
+2
View File
@@ -53,6 +53,8 @@ pub async fn run(config: Config) -> anyhow::Result<()> {
app_name: config.app_name,
cookie_secure: config.cookie_secure,
search,
default_language: config.default_language,
default_timezone: config.default_timezone,
};
let listener = TcpListener::bind(&config.bind_addr)
+2
View File
@@ -17,6 +17,8 @@ async fn serves_health_live_over_tcp() {
app_name: "Test".to_string(),
cookie_secure: false,
search: None,
default_language: "sv".into(),
default_timezone: "Europe/Stockholm".into(),
};
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();