Impeove invalid config_file_path handling

1. Besides opt.config_file_path, also consider MEILI_CONFIG_FILE_PATH in the Err path because they are both user input.
2. Print out the incorrect file path in error message.
3. Add tests
https://github.com/meilisearch/meilisearch/pull/2804#discussion_r991999888
This commit is contained in:
Lawrence Chou
2022-10-12 11:58:28 +08:00
parent 91accc0194
commit 3c3ae3ff98
3 changed files with 49 additions and 8 deletions

10
Cargo.lock generated
View File

@ -2095,6 +2095,7 @@ dependencies = [
"static-files",
"sysinfo",
"tar",
"temp-env",
"tempfile",
"thiserror",
"time",
@ -3451,6 +3452,15 @@ dependencies = [
"xattr",
]
[[package]]
name = "temp-env"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a30d48359f77fbb6af3d7b928cc2d092e1dc90b44f397e979ef08ae15733ed65"
dependencies = [
"once_cell",
]
[[package]]
name = "tempfile"
version = "3.3.0"