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,
}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)
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_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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for DistriConfig
impl JsonSchema for DistriConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$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
Mutably borrows from an owned value. Read more
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§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
Compare self to
key and return true if they are equal.