Skip to content

Commit

Permalink
fix issue with toml configuration missing url value
Browse files Browse the repository at this point in the history
  • Loading branch information
t-aleksander committed Nov 21, 2024
1 parent 00c6b41 commit 96ac29c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions example-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ grpc_port = 50051
log_level = "info"
rate_limit_per_second = 0
rate_limit_burst = 0
url = "http://localhost:8080"
5 changes: 5 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 96ac29c

Please sign in to comment.