Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace homegrown config parser with figment #41

Merged
merged 4 commits into from
May 25, 2023
Merged

Replace homegrown config parser with figment #41

merged 4 commits into from
May 25, 2023

Conversation

alcroito
Copy link
Owner

Breaking change: toml parsing is now strict, so existing configuration files need to be updated to ensure booleans and numbers aren't quoted anymore (and thus treated as strings).

Replace usage of humantime::Duration with std::time::Duration in
UpdateInterval.

As a drive-by for the future, add serializer support to UpdateInterval.
Use humantime-serde crate for that.

Remove old unused fork that was in humantime_wrapper_serde.rs, there's
no need to store a humantime::Duration in the interval, it's
sufficient to store just an std::time::Duration and do parsing and
formatting as appropriate.

Presumably I wrote the fork because I thought I needed the FromStr
impl that humantime::Duration provided.
Add figment, figment_file_provider_adapter, humantime-serde packages.
Enable the clap derive feature to switch to derive-style argument
parsing.
Enable the secrecy serde feature to allow serialization of secrets
(needed for token configuration management).
@alcroito alcroito added dependency Dependency updates breaking Breaking changes fix Bug fixes other Internal improvements labels May 24, 2023
Use figment for parsing configuration from env vars, cli, toml file.

Switch from clap builder api to clap derive api. This creates a struct
that then be fed to figment.

Remove old homegrown config builder.

Remove direct toml dependency, it's handled by figment now.

Update documentation concerning booleanss and numbers.

BREAKING CHANGE: toml booleans and numbers in the config files
can't be quoted anymore. Previously they had to be quoted strings due
to implementation issues.
Shows nicer error reports when a test fails.
Because the install hook needs to be called once per process, and
cargo runs tests in parallel in the same process, the install hook
needs to be protected by a OnceCell.

Inspired by https://github.com/yaahc/color-eyre/pull/118/files
@alcroito alcroito merged commit 92aa353 into master May 25, 2023
@alcroito alcroito deleted the figment branch May 25, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking changes dependency Dependency updates fix Bug fixes other Internal improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant