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: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
3cfa34d8b8
commit
2832d8cb93
1 changed files with 6 additions and 3 deletions
|
@ -63,15 +63,18 @@ struct Args;
|
|||
async fn main() {
|
||||
Args::parse();
|
||||
// Initialize config
|
||||
let raw_config =
|
||||
let raw_config = if Env::var("CONDUIT_CONFIG").is_some() {
|
||||
Figment::new()
|
||||
.merge(
|
||||
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(),
|
||||
)
|
||||
.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>() {
|
||||
Ok(s) => s,
|
||||
|
|
Loading…
Add table
Reference in a new issue