From 35ed731a4680244bdacfe53a3b6ce3cc79682d11 Mon Sep 17 00:00:00 2001 From: Matthias Ahouansou Date: Tue, 2 Jul 2024 15:39:45 +0100 Subject: [PATCH] feat(config): split on __, allowing for setting individual values in a table --- docs/configuration.md | 2 ++ src/main.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index d903a21e..2239ac5d 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -6,6 +6,8 @@ > **Note:** If you update the configuration file, you must restart Conduit for the changes to take effect +> **Note:** You can also configure Conduit by using `CONDUIT_{field_name}` environment variables. To set values inside a table, use `CONDUIT_{table_name}__{field_name}`. Example: `CONDUIT_SERVER_NAME="example.org"` + Conduit's configuration file is divided into the following sections: - [Global](#global) diff --git a/src/main.rs b/src/main.rs index 8d242c53..7134564b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,7 +57,7 @@ async fn main() { )) .nested(), ) - .merge(Env::prefixed("CONDUIT_").global()); + .merge(Env::prefixed("CONDUIT_").global().split("__")); let config = match raw_config.extract::() { Ok(s) => s,