diff --git a/Cargo.lock b/Cargo.lock index 7a2d9c3..bc1a80c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -532,7 +532,7 @@ dependencies = [ [[package]] name = "defguard-proxy" -version = "1.1.0" +version = "1.1.1" dependencies = [ "anyhow", "axum", diff --git a/Cargo.toml b/Cargo.toml index bd5a50d..e6a5db9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "defguard-proxy" -version = "1.1.0" +version = "1.1.1" edition = "2021" license = "Apache-2.0" homepage = "https://github.com/DefGuard/proxy" diff --git a/example-config.toml b/example-config.toml index 025d18d..b6dc4d3 100644 --- a/example-config.toml +++ b/example-config.toml @@ -16,3 +16,4 @@ grpc_port = 50051 log_level = "info" rate_limit_per_second = 0 rate_limit_burst = 0 +url = "http://localhost:8080" diff --git a/src/config.rs b/src/config.rs index b1dcd5e..4c64429 100644 --- a/src/config.rs +++ b/src/config.rs @@ -5,6 +5,10 @@ use log::LevelFilter; use serde::Deserialize; use url::Url; +fn default_url() -> Url { + Url::parse("http://localhost:8080").unwrap() +} + #[derive(Parser, Debug, Deserialize)] #[command(version)] pub struct Config { @@ -42,6 +46,7 @@ pub struct Config { value_parser = Url::parse, default_value = "http://localhost:8080" )] + #[serde(default = "default_url")] pub url: Url, /// Configuration file path