An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: add RelayClient::new_with_url and base_url_str for runtime URL support

authored by

Malpercio and committed by
Tangled
724c9a17 8ce0ea38

+18 -2
+18 -2
apps/identity-wallet/src-tauri/src/http.rs
··· 41 41 /// HTTP client for relay API requests. 42 42 pub struct RelayClient { 43 43 client: Client, 44 - base_url: &'static str, 44 + base_url: String, 45 45 } 46 46 47 47 impl RelayClient { ··· 49 49 pub fn new() -> Self { 50 50 Self { 51 51 client: Client::new(), 52 - base_url: RELAY_BASE_URL, 52 + base_url: RELAY_BASE_URL.to_string(), 53 + } 54 + } 55 + 56 + /// Create a new `RelayClient` with a runtime-provided base URL. 57 + /// 58 + /// The URL must not have a trailing slash. Used when the relay URL is 59 + /// configured at runtime rather than baked in at compile time. 60 + pub fn new_with_url(url: String) -> Self { 61 + Self { 62 + client: Client::new(), 63 + base_url: url, 53 64 } 54 65 } 55 66 ··· 194 205 /// Used as the `service_endpoint` parameter in DID ceremony genesis op construction. 195 206 pub const fn base_url() -> &'static str { 196 207 RELAY_BASE_URL 208 + } 209 + 210 + /// Returns the base URL for this relay client instance. 211 + pub fn base_url_str(&self) -> &str { 212 + &self.base_url 197 213 } 198 214 } 199 215