upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-11 16:53:03 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-11 16:53:03 +0000
commit2a9160836bb87fdea3ae891563b0169c68d1c2ab (patch)
tree583c890687beaf7f380fc0be131bdf17485f06fa /src/config.rs
parent52489d3b1a7d79e164b4cc901b53fd06c05ce1b1 (diff)
fix: resolve all fmt and clippy warnings
Main lib (src/): - Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration) - Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting) - Replace .or_insert_with(RelaySyncNeeds::default) with .or_default() - Replace manual div_ceil implementations with .div_ceil(100) Test code (tests/): - Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...)) - Remove needless borrows in fetch_metrics() calls - Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module grasp-audit: - Apply cargo fmt to fix formatting
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs
index 8c6de05..7834a3f 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -77,11 +77,19 @@ pub struct Config {
77 pub metrics_enabled: bool, 77 pub metrics_enabled: bool,
78 78
79 /// Connections per IP before flagging as potential abuse in metrics (display only, no rate limiting) 79 /// Connections per IP before flagging as potential abuse in metrics (display only, no rate limiting)
80 #[arg(long = "metrics-connection-per-ip-abuse-threshold", env = "NGIT_METRICS_CONNECTION_PER_IP_ABUSE_THRESHOLD", default_value_t = 10)] 80 #[arg(
81 long = "metrics-connection-per-ip-abuse-threshold",
82 env = "NGIT_METRICS_CONNECTION_PER_IP_ABUSE_THRESHOLD",
83 default_value_t = 10
84 )]
81 pub metrics_connection_per_ip_abuse_threshold: u32, 85 pub metrics_connection_per_ip_abuse_threshold: u32,
82 86
83 /// Number of top bandwidth repos to track in metrics 87 /// Number of top bandwidth repos to track in metrics
84 #[arg(long = "metrics-top-n-repos", env = "NGIT_METRICS_TOP_N_REPOS", default_value_t = 10)] 88 #[arg(
89 long = "metrics-top-n-repos",
90 env = "NGIT_METRICS_TOP_N_REPOS",
91 default_value_t = 10
92 )]
85 pub metrics_top_n_repos: usize, 93 pub metrics_top_n_repos: usize,
86 94
87 /// URL of bootstrap relay to sync from on startup (optional) 95 /// URL of bootstrap relay to sync from on startup (optional)
@@ -95,7 +103,11 @@ pub struct Config {
95 103
96 /// Interval in seconds for checking disconnected relays and attempting reconnection (default: 60) 104 /// Interval in seconds for checking disconnected relays and attempting reconnection (default: 60)
97 /// Set to lower value for faster reconnection testing 105 /// Set to lower value for faster reconnection testing
98 #[arg(long, env = "NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS", default_value_t = 60)] 106 #[arg(
107 long,
108 env = "NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS",
109 default_value_t = 60
110 )]
99 pub sync_disconnect_check_interval_secs: u64, 111 pub sync_disconnect_check_interval_secs: u64,
100 112
101 /// Base backoff time in seconds for relay reconnection (default: 5) 113 /// Base backoff time in seconds for relay reconnection (default: 5)