diff options
-rw-r--r-- | src/config/environment.rs | 6 | ||||
-rw-r--r-- | src/config/mod.rs | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/config/environment.rs b/src/config/environment.rs index b618896..2385b28 100644 --- a/src/config/environment.rs +++ b/src/config/environment.rs @@ -55,9 +55,9 @@ const ROUGHENOUGH_KEY_PROTECTION: &str = "ROUGHENOUGH_KEY_PROTECTION"; impl EnvironmentConfig { pub fn new() -> Result<Self, Error> { let mut cfg = EnvironmentConfig { - port: 8686, - interface: "127.0.0.1".to_string(), - seed: hex::decode("a32049da0ffde0ded92ce10a0230d35fe615ec8461c14986baa63fe3b3bac3db").unwrap(), + port: 0, + interface: "".to_string(), + seed: Vec::new(), batch_size: DEFAULT_BATCH_SIZE, status_interval: DEFAULT_STATUS_INTERVAL, key_protection: KeyProtection::Plaintext, diff --git a/src/config/mod.rs b/src/config/mod.rs index f05578b..b70bbd5 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -112,6 +112,21 @@ pub fn make_config(arg: &str) -> Result<Box<ServerConfig>, Error> { } } +/// Creates a config suitable for fuzzing a server instance +/// This is intended to create a minimal useable config +/// that allows a server to respond to requests. +#[cfg(fuzzing)] +pub fn make_fuzzing_config(port: u16) -> Box<ServerConfig> { + return Box(EnvironmentConfig { + port, + interface: "127.0.0.1".to_string(), + seed: hex::decode("a32049da0ffde0ded92ce10a0230d35fe615ec8461c14986baa63fe3b3bac3db").unwrap(), + batch_size: DEFAULT_BATCH_SIZE, + status_interval: DEFAULT_STATUS_INTERVAL, + key_protection: KeyProtection::Plaintext + }) +} + /// /// Validate configuration settings. Returns `true` if the config is valid, `false` otherwise. /// |