Skip to content

Commit 3007554

Browse files
authored
Merge pull request #65 from w-henderson/fix-defaults
Fix default configuration for Server
2 parents 8fe55ff + 94593a8 commit 3007554

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

humphrey-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "humphrey_server"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
edition = "2018"
55
license = "MIT"
66
homepage = "https://github.com/w-henderson/Humphrey"

humphrey-server/src/config/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub struct Config {
4343
}
4444

4545
/// Represents the configuration for a specific host.
46-
#[derive(Debug, Default, PartialEq)]
46+
#[derive(Debug, PartialEq)]
4747
pub struct HostConfig {
4848
/// Wildcard string specifying what hosts to match, e.g. `*.example.com`
4949
pub matches: String,

humphrey-server/src/config/default.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Provides default values for the configuration.
22
33
use crate::config::{
4-
BlacklistConfig, BlacklistMode, Config, LoggingConfig, RouteConfig, RouteType,
4+
BlacklistConfig, BlacklistMode, Config, HostConfig, LoggingConfig, RouteConfig, RouteType,
55
};
66
use crate::server::logger::LogLevel;
77

@@ -14,7 +14,7 @@ impl Default for Config {
1414
#[cfg(feature = "tls")]
1515
tls_config: None,
1616
default_websocket_proxy: None,
17-
hosts: vec![Default::default()],
17+
hosts: Vec::new(),
1818
default_host: Default::default(),
1919
#[cfg(feature = "plugins")]
2020
plugins: Vec::new(),
@@ -25,6 +25,15 @@ impl Default for Config {
2525
}
2626
}
2727

28+
impl Default for HostConfig {
29+
fn default() -> Self {
30+
Self {
31+
matches: "*".into(),
32+
routes: vec![Default::default()],
33+
}
34+
}
35+
}
36+
2837
impl Default for RouteConfig {
2938
fn default() -> Self {
3039
Self {

humphrey/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "humphrey"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
edition = "2018"
55
license = "MIT"
66
homepage = "https://github.com/w-henderson/Humphrey"

0 commit comments

Comments
 (0)