Fix metrics check when disabled
Previously, disabled metrics had no effect and a request to the `/metrics` route was answered nonetheless. Remove needles borrow
This commit is contained in:
parent
a122bf28d2
commit
e7e136195b
1 changed files with 6 additions and 4 deletions
|
@ -425,6 +425,7 @@ async fn metrics(
|
||||||
config: &State<Config>,
|
config: &State<Config>,
|
||||||
) -> Option<String> {
|
) -> Option<String> {
|
||||||
if let Some(metrics_config) = &config.metrics {
|
if let Some(metrics_config) = &config.metrics {
|
||||||
|
if metrics_config.enabled {
|
||||||
if let Some(filter) = &metrics_config.ip_filter {
|
if let Some(filter) = &metrics_config.ip_filter {
|
||||||
if filter.validate(&address.ip()) {
|
if filter.validate(&address.ip()) {
|
||||||
return Some(get_metrics(metrics));
|
return Some(get_metrics(metrics));
|
||||||
|
@ -433,6 +434,7 @@ async fn metrics(
|
||||||
return Some(get_metrics(metrics));
|
return Some(get_metrics(metrics));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
warn!("Forbidden request for metrics: {:?}", address);
|
warn!("Forbidden request for metrics: {:?}", address);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue