feat(cli): add config file support

- load configuration from a file
- use config crate for config loading
- allow overriding config with environment variables
- set default credential path
- fix error handling for config loading
This commit is contained in:
Jeremiah Russell
2025-10-15 16:02:48 +01:00
committed by Jeremiah Russell
parent 6b9ce2670e
commit c53ad65368
4 changed files with 48 additions and 21 deletions

23
Cargo.lock generated
View File

@@ -240,6 +240,19 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
name = "config"
version = "0.15.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e549344080374f9b32ed41bf3b6b57885ff6a289367b3dbc10eea8acc1918"
dependencies = [
"pathdiff",
"serde_core",
"serde_json",
"toml",
"winnow",
]
[[package]]
name = "core-foundation"
version = "0.10.1"
@@ -263,6 +276,7 @@ dependencies = [
"chrono",
"clap",
"clap-verbosity-flag",
"config",
"env_logger",
"google-gmail1",
"log",
@@ -1017,6 +1031,12 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "pathdiff"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]]
name = "percent-encoding"
version = "2.3.2"
@@ -1964,6 +1984,9 @@ name = "winnow"
version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
dependencies = [
"memchr",
]
[[package]]
name = "writeable"