pub struct ClientConfig {
pub api_key: Option<String>,
pub api_secret: Option<String>,
pub rest_url: String,
pub ws_url: String,
pub access_window_ms: u64,
pub timeout: Duration,
pub allow_insecure_transport: bool,
}Expand description
Configuration shared by the REST and WebSocket clients.
The Debug implementation redacts the API key and secret.
Fields§
§api_key: Option<String>§api_secret: Option<String>§rest_url: String§ws_url: String§access_window_ms: u64Time in milliseconds during which a signed request stays valid.
timeout: DurationHTTP request and WebSocket connection timeout.
allow_insecure_transport: boolAllows unencrypted http and ws URLs.
This option is intended only for local testing.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn with_credentials(
api_key: impl Into<String>,
api_secret: impl Into<String>,
) -> Self
pub fn with_credentials( api_key: impl Into<String>, api_secret: impl Into<String>, ) -> Self
Creates a configuration with API credentials.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Reads credentials from the BITVAVO_API_KEY and BITVAVO_API_SECRET
environment variables.
Returns a public-only configuration when the variables are not set.
Sourcepub fn access_window_ms(self, window: u64) -> Self
pub fn access_window_ms(self, window: u64) -> Self
Sets the access window in milliseconds.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets the HTTP request and WebSocket connection timeout.
Sourcepub fn danger_allow_insecure_transport(self, allow: bool) -> Self
pub fn danger_allow_insecure_transport(self, allow: bool) -> Self
Allows unencrypted http and ws URLs.
Enabling this can expose API credentials and must only be used for local testing.
Sourcepub fn has_credentials(&self) -> bool
pub fn has_credentials(&self) -> bool
Returns true when both API key and secret are set.