edid throws an error when default config file path does not exist (even with env vars set)
Summary
edid errors when a config file with the default name does not exist, even when environment variables are set. 4b805946 introduced this bug.
What is the current bug behavior?
big-donut in edihkal/edid on develop [?⇣] is 📦 v0.1.0 via 🦀 v1.65.0
✗ ls edid.yaml
ls: cannot access 'edid.yaml': No such file or directory
big-donut in edihkal/edid on develop [?⇣] is 📦 v0.1.0 via 🦀 v1.65.0
✗ EDID_EDIHKAL_URL=localhost:8080 cargo run -- drugs define musique
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Running `/home/travis/projects/edihkal/target/debug/edid drugs define musique`
Error: Failed to load configuration
Caused by:
configuration file "edid.yaml" not found
What is the expected correct behavior?
The config file should not need to exist if EDID_EDIHKAL_URL
is set. edid.yaml
should only be loaded if the environment variable is not set (meaning some config is required) and if the user did not specify edid -c <config_path>
.
Possible fixes
Getting the desired behavior with the config
crate is looking slightly more complicated than desired, and this also needs human-friendly error messages explaining exactly what config is missing/needed & what to specify.
Consider looking @ other crates that may be more ergonomic. Crates to look at (TODO: enumerate other alternatives):
Edited by lazulite