Environment parsing done with Serde Envy #5
Loading…
Reference in a new issue
No description provided.
Delete branch "adrien/diplonat:feature/config-handling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Solves #2
I replaced
src/environment.rs
with asrc/config/
dir containing three files:options.rs
defines the parameters deserialised from the environment using Serde Envy;runtime.rs
parses theConfigOpts
struct (fromoptions.rs
) into aRuntimeConfig
struct, applying business logic;options_test.rs
provides four unit tests:Be aware that the
config/
implementation is future-proof: it would be super simple to have a configuration file in addition to the environment variables.Becauuuse I took inspiration from the Trunk crate, which does exactly that, and even command-line parameters:
CLI
superseedesenv
that superseedes configuration file.LGTM :)
LGTM, thanks !