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

Fix default configuration for Server #65

Merged
merged 2 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion humphrey-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "humphrey_server"
version = "0.4.0"
version = "0.4.1"
edition = "2018"
license = "MIT"
homepage = "https://github.com/w-henderson/Humphrey"
Expand Down
2 changes: 1 addition & 1 deletion humphrey-server/src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct Config {
}

/// Represents the configuration for a specific host.
#[derive(Debug, Default, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct HostConfig {
/// Wildcard string specifying what hosts to match, e.g. `*.example.com`
pub matches: String,
Expand Down
13 changes: 11 additions & 2 deletions humphrey-server/src/config/default.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Provides default values for the configuration.

use crate::config::{
BlacklistConfig, BlacklistMode, Config, LoggingConfig, RouteConfig, RouteType,
BlacklistConfig, BlacklistMode, Config, HostConfig, LoggingConfig, RouteConfig, RouteType,
};
use crate::server::logger::LogLevel;

Expand All @@ -14,7 +14,7 @@ impl Default for Config {
#[cfg(feature = "tls")]
tls_config: None,
default_websocket_proxy: None,
hosts: vec![Default::default()],
hosts: Vec::new(),
default_host: Default::default(),
#[cfg(feature = "plugins")]
plugins: Vec::new(),
Expand All @@ -25,6 +25,15 @@ impl Default for Config {
}
}

impl Default for HostConfig {
fn default() -> Self {
Self {
matches: "*".into(),
routes: vec![Default::default()],
}
}
}

impl Default for RouteConfig {
fn default() -> Self {
Self {
Expand Down
2 changes: 1 addition & 1 deletion humphrey/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "humphrey"
version = "0.4.1"
version = "0.4.2"
edition = "2018"
license = "MIT"
homepage = "https://github.com/w-henderson/Humphrey"
Expand Down