pub struct DistriConfig {
pub base_url: String,
pub api_key: Option<String>,
pub workspace_id: Option<String>,
pub timeout_secs: u64,
pub retry_attempts: u32,
pub traceparent: Option<String>,
}Expand description
Configuration for the Distri client.
Fields§
§base_url: StringBase URL of the Distri server
api_key: Option<String>Optional API key for authentication
workspace_id: Option<String>Optional workspace ID for multi-tenant context
timeout_secs: u64Request timeout in seconds (default: 30)
retry_attempts: u32Number of retry attempts for failed requests (default: 3)
traceparent: Option<String>W3C traceparent header value for distributed tracing. Not serialized — set at runtime via CLI flag or programmatically.
Implementations§
Source§impl DistriConfig
impl DistriConfig
Sourcepub fn config_path() -> Option<PathBuf>
pub fn config_path() -> Option<PathBuf>
Path to the local client config file (~/.distri/config).
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Create a new config with the specified base URL.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a config from environment variables and the local config file.
Precedence: environment variables > ~/.distri/config > defaults.
~/.distri/config supports base_url, api_key, and workspace_id.
DISTRI_BASE_URL: Base URL (defaults tohttps://api.distri.dev/v1)DISTRI_API_KEY: Optional API keyDISTRI_WORKSPACE_ID: Optional workspace ID (UUID)
Sourcepub fn with_api_key(self, api_key: impl Into<String>) -> Self
pub fn with_api_key(self, api_key: impl Into<String>) -> Self
Set the API key for authentication.
Sourcepub fn with_workspace_id(self, workspace_id: impl Into<String>) -> Self
pub fn with_workspace_id(self, workspace_id: impl Into<String>) -> Self
Set the workspace ID for multi-tenant context.
Sourcepub fn with_maybe_api_key(self, api_key: Option<String>) -> Self
pub fn with_maybe_api_key(self, api_key: Option<String>) -> Self
Set the API key if Some. Does not change the value when None.
Sourcepub fn with_maybe_workspace_id(self, workspace_id: Option<String>) -> Self
pub fn with_maybe_workspace_id(self, workspace_id: Option<String>) -> Self
Set the workspace ID if Some. Does not change the value when None.
Sourcepub fn with_timeout(self, timeout_secs: u64) -> Self
pub fn with_timeout(self, timeout_secs: u64) -> Self
Set the request timeout in seconds.
Sourcepub fn with_retries(self, retry_attempts: u32) -> Self
pub fn with_retries(self, retry_attempts: u32) -> Self
Set the number of retry attempts.
Trait Implementations§
Source§impl Clone for DistriConfig
impl Clone for DistriConfig
Source§fn clone(&self) -> DistriConfig
fn clone(&self) -> DistriConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DistriConfig
impl Debug for DistriConfig
Source§impl Default for DistriConfig
impl Default for DistriConfig
Source§impl<'de> Deserialize<'de> for DistriConfig
impl<'de> Deserialize<'de> for DistriConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for DistriConfig
impl JsonSchema for DistriConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for DistriConfig
impl PartialEq for DistriConfig
Source§impl Serialize for DistriConfig
impl Serialize for DistriConfig
impl Eq for DistriConfig
impl StructuralPartialEq for DistriConfig
Auto Trait Implementations§
impl Freeze for DistriConfig
impl RefUnwindSafe for DistriConfig
impl Send for DistriConfig
impl Sync for DistriConfig
impl Unpin for DistriConfig
impl UnsafeUnpin for DistriConfig
impl UnwindSafe for DistriConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.