diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-07-18 03:39:59 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-07-18 03:41:17 -0400 |
commit | d2a97be689b034ed056f3ba41a9775635872a073 (patch) | |
tree | b3b7cdba70d065f78465690b9e6e014f7c085e5f /src/config.rs | |
parent | cf75da99817cadba82299ef3d106da5308433486 (diff) | |
download | rbw-d2a97be689b034ed056f3ba41a9775635872a073.tar.gz rbw-d2a97be689b034ed056f3ba41a9775635872a073.zip |
fix websockets for self-hosted bitwarden
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index d70a21b..03a9641 100644 --- a/src/config.rs +++ b/src/config.rs @@ -8,6 +8,7 @@ pub struct Config { pub email: Option<String>, pub base_url: Option<String>, pub identity_url: Option<String>, + pub notifications_url: Option<String>, #[serde(default = "default_lock_timeout")] pub lock_timeout: u64, #[serde(default = "default_sync_interval")] @@ -26,6 +27,7 @@ impl Default for Config { email: None, base_url: None, identity_url: None, + notifications_url: None, lock_timeout: default_lock_timeout(), sync_interval: default_sync_interval(), pinentry: default_pinentry(), @@ -159,6 +161,16 @@ impl Config { } #[must_use] + pub fn notifications_url(&self) -> String { + self.notifications_url.clone().unwrap_or_else(|| { + self.base_url.clone().map_or_else( + || "https://notifications.bitwarden.com".to_string(), + |url| format!("{}/notifications", url.trim_end_matches('/')), + ) + }) + } + + #[must_use] pub fn client_cert_path(&self) -> Option<&std::path::Path> { self.client_cert_path.as_deref() } |