pub struct Config {
pub chains: ChainsConfig,
pub output: OutputConfig,
pub address_book: AddressBookConfig,
pub monitor: MonitorConfig,
pub ghola: GholaConfig,
pub web: WebConfig,
pub market: MarketConfig,
}Expand description
Application configuration.
Contains all settings for blockchain clients, output formatting,
and address book management. Use Config::load to load from file
or Config::default for sensible defaults.
§Examples
use scope::Config;
// Load from default location or custom path
let config = Config::load(None).unwrap_or_default();
println!("Output format: {:?}", config.output.format);Fields§
§chains: ChainsConfigBlockchain chain client configuration.
output: OutputConfigOutput formatting configuration.
address_book: AddressBookConfigAddress book configuration (label → address mapping storage).
monitor: MonitorConfigMonitor TUI configuration (layout, widgets, refresh rate).
ghola: GholaConfigGhola sidecar configuration for stealth HTTP transport.
web: WebConfigWeb server configuration.
market: MarketConfigMarket analysis configuration (order book health thresholds).
Implementations§
Source§impl Config
impl Config
Sourcepub fn load(path: Option<&Path>) -> Result<Self>
pub fn load(path: Option<&Path>) -> Result<Self>
Loads configuration from a file path or the default location.
§Arguments
path- Optional path to a configuration file. IfNone, looks for config at~/.config/scope/config.yaml.
§Returns
Returns the loaded configuration, or defaults if no config file exists.
§Errors
Returns ScopeError::Config if the file exists but cannot be read
or contains invalid YAML.
§Examples
use scope::Config;
use std::path::Path;
// Load from default location
let config = Config::load(None).unwrap_or_default();
// Load from custom path
let config = Config::load(Some(Path::new("/custom/config.yaml")));Sourcepub fn default_path() -> PathBuf
pub fn default_path() -> PathBuf
Returns the default configuration file path.
Checks multiple locations in order:
~/.config/scope/config.yaml(XDG-style, preferred for CLI tools)- Platform-specific config dir (e.g.,
~/Library/Application Support/on macOS)
Returns the first location that exists, or the XDG-style path if neither exists.
Sourcepub fn config_path() -> Option<PathBuf>
pub fn config_path() -> Option<PathBuf>
Returns the configuration file path, if it can be determined.
Returns Some(path) for the config file location, or None if
the path cannot be determined (e.g., no home directory).
Prefers the XDG-style ~/.config/scope/ location.
Sourcepub fn default_data_dir() -> PathBuf
pub fn default_data_dir() -> PathBuf
Returns the default data directory for address book storage.
Uses ~/.config/scope/data on all platforms for consistency.