From ae9550ce23bbc85b05669fe5ec4406c8a67417ec Mon Sep 17 00:00:00 2001 From: LUXEY Adrien Date: Sat, 14 Aug 2021 19:12:18 +0200 Subject: New configuration parsing using envy. Added minimal functionnality for the future ACME parameters. Tests written and passing. WIP: added envy dependncy and ConfigOpts structs that will constitute Diplonat's configuration WIP: ConfigOpts from_env() and validate() methods written. No API change (the env names remain unchanged)! Now need to use our new ConfigOpts struct instead of Environment, and update references to the environment variables in the code. WIP: RuntimeConfig with business logic done. Tests written, but they are all running from the same process - setting environment variables in each test produces incoherent results. Another solution for testing is needed. WIP: tests are fully written using 'from_iter' and all passing --- src/config/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/config/mod.rs (limited to 'src/config/mod.rs') diff --git a/src/config/mod.rs b/src/config/mod.rs new file mode 100644 index 0000000..14926bd --- /dev/null +++ b/src/config/mod.rs @@ -0,0 +1,11 @@ +mod options; +#[cfg(test)] +mod options_test; +mod runtime; + +pub use options::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul}; +pub use runtime::{RuntimeConfig, RuntimeConfigAcme, RuntimeConfigConsul, RuntimeConfigFirewall, RuntimeConfigIgd}; + +pub const EXPIRATION_TIME: u16 = 300; +pub const REFRESH_TIME: u16 = 60; +pub const CONSUL_URL: &str = "http://127.0.0.1:8500"; \ No newline at end of file -- cgit v1.2.3