Skip to content
Snippets Groups Projects
Commit 2832d8cb authored by 🥺's avatar 🥺 :transgender_flag: Committed by 🥺
Browse files

make CONDUIT_CONFIG optional


retains compatibility for container users
who set it to empty.

if the variable is unspecified, it will
use the CONDUIT_ variables as normal.

Signed-off-by: default avatarstrawberry <strawberry@puppygock.gay>
parent 3cfa34d8
No related branches found
No related tags found
No related merge requests found
...@@ -63,15 +63,18 @@ ...@@ -63,15 +63,18 @@
async fn main() { async fn main() {
Args::parse(); Args::parse();
// Initialize config // Initialize config
let raw_config = let raw_config = if Env::var("CONDUIT_CONFIG").is_some() {
Figment::new() Figment::new()
.merge( .merge(
Toml::file(Env::var("CONDUIT_CONFIG").expect( Toml::file(Env::var("CONDUIT_CONFIG").expect(
"The CONDUIT_CONFIG env var needs to be set. Example: /etc/conduit.toml", "The CONDUIT_CONFIG environment variable was set but appears to be invalid. This should be set to the path to a valid TOML file, an empty string (for compatibility), or removed/unset entirely.",
)) ))
.nested(), .nested(),
) )
.merge(Env::prefixed("CONDUIT_").global()); .merge(Env::prefixed("CONDUIT_").global())
} else {
Figment::new().merge(Env::prefixed("CONDUIT_").global())
};
let config = match raw_config.extract::<Config>() { let config = match raw_config.extract::<Config>() {
Ok(s) => s, Ok(s) => s,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment