#[non_exhaustive]pub struct Config {
pub download: DownloadConfig,
pub network: NetworkConfig,
pub hub: HubConfig,
pub bt: BtConfig,
pub state_dir: Option<PathBuf>,
pub headers: BTreeMap<String, String>,
}Expand description
Effective configuration. Precedence is CLI flags > config file >
environment variables > built-in defaults; see Config::load.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.download: DownloadConfigDownload behavior and defaults.
network: NetworkConfigHTTP timeout, retry and user-agent settings.
hub: HubConfigHub provider cache and endpoint settings.
bt: BtConfigBitTorrent backend settings.
state_dir: Option<PathBuf>Directory for task sidecars; defaults to the platform data directory.
headers: BTreeMap<String, String>Default headers applied to every request; values may use ${env:NAME}
placeholders.
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_config_path() -> Result<PathBuf>
pub fn default_config_path() -> Result<PathBuf>
Platform default config file path (config.toml in the user config
directory).
Sourcepub fn default_state_dir() -> Result<PathBuf>
pub fn default_state_dir() -> Result<PathBuf>
Platform default directory for task sidecars.
Sourcepub fn state_dir(&self) -> Result<PathBuf>
pub fn state_dir(&self) -> Result<PathBuf>
Configured state directory, or the platform default.
Sourcepub fn hf_cache_dir(&self) -> Result<PathBuf>
pub fn hf_cache_dir(&self) -> Result<PathBuf>
Resolved Hugging Face cache root: configured override or
~/.cache/huggingface/hub.
Sourcepub fn modelscope_cache_dir(&self) -> Result<PathBuf>
pub fn modelscope_cache_dir(&self) -> Result<PathBuf>
Resolved ModelScope cache root: configured override or the platform cache directory.
Sourcepub fn content_cache_dir(&self) -> Result<PathBuf>
pub fn content_cache_dir(&self) -> Result<PathBuf>
Resolved content-addressed cache root: configured override or the
platform cache directory under shaul/content.
Sourcepub fn hf_endpoint(&self) -> String
pub fn hf_endpoint(&self) -> String
Configured Hugging Face endpoint or the public default.
Sourcepub fn modelscope_endpoint(&self) -> String
pub fn modelscope_endpoint(&self) -> String
Configured ModelScope endpoint or the public default.
Sourcepub fn resolve_path(explicit: Option<&Path>) -> Result<PathBuf>
pub fn resolve_path(explicit: Option<&Path>) -> Result<PathBuf>
Resolve the config path from an explicit argument, SHAUL_CONFIG, or
the platform default.
Sourcepub fn load(explicit: Option<&Path>) -> Result<(Self, PathBuf)>
pub fn load(explicit: Option<&Path>) -> Result<(Self, PathBuf)>
Load defaults, then environment variables, then the config file. CLI flags are applied by the caller afterwards.
Sourcepub fn load_file_only(path: &Path) -> Result<Self>
pub fn load_file_only(path: &Path) -> Result<Self>
Load only defaults + file. Used by config set so environment values
are not baked into the file.
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Serialize the config as TOML, creating parent directories as needed.
Sourcepub fn apply_env(&mut self) -> Result<()>
pub fn apply_env(&mut self) -> Result<()>
Apply SHAUL_* and provider environment variables on top of the
current values.
Sourcepub fn header_defaults(&self) -> Result<Vec<Header>>
pub fn header_defaults(&self) -> Result<Vec<Header>>
Parse the configured default headers into validated Header values.
Sourcepub fn resolve(
&self,
destination: &Path,
options: &TaskOptions,
) -> Result<ResolvedOptions>
pub fn resolve( &self, destination: &Path, options: &TaskOptions, ) -> Result<ResolvedOptions>
Combine config defaults with per-task options into fully resolved settings.