1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct SentryTunnelConfig {
6 pub sentry_host: String,
8
9 pub allowed_project_ids: Vec<String>,
11
12 #[serde(default = "default_path")]
14 pub path: String,
15
16 #[serde(default = "default_timeout")]
18 pub timeout_secs: u64,
19}
20
21fn default_path() -> String {
22 "/tunnel".to_string()
23}
24
25fn default_timeout() -> u64 {
26 30
27}
28
29impl SentryTunnelConfig {
30 pub fn new(sentry_host: impl Into<String>, allowed_project_ids: Vec<String>) -> Self {
32 Self {
33 sentry_host: sentry_host.into(),
34 allowed_project_ids,
35 path: default_path(),
36 timeout_secs: default_timeout(),
37 }
38 }
39
40 pub fn with_path(mut self, path: impl Into<String>) -> Self {
42 self.path = path.into();
43 self
44 }
45
46 pub fn with_timeout(mut self, timeout_secs: u64) -> Self {
48 self.timeout_secs = timeout_secs;
49 self
50 }
51}