pub struct Config {
pub gateway: GatewayConfig,
pub agents: HashMap<String, AgentConfig>,
pub channels: ChannelsConfig,
pub providers: ProvidersConfig,
pub settings: GlobalSettings,
}Expand description
Main configuration structure.
Matches the existing OpenClaw JSON5 config schema.
Fields§
§gateway: GatewayConfigGateway configuration.
agents: HashMap<String, AgentConfig>Agent configurations by ID.
channels: ChannelsConfigChannel configurations.
providers: ProvidersConfigProvider configurations.
settings: GlobalSettingsGlobal settings.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_default() -> Result<Self, ConfigError>
pub fn load_default() -> Result<Self, ConfigError>
Load configuration from the default location.
§Errors
Returns error if config cannot be loaded or parsed.
Sourcepub fn load(path: &Path) -> Result<Self, ConfigError>
pub fn load(path: &Path) -> Result<Self, ConfigError>
Sourcepub fn default_path() -> PathBuf
pub fn default_path() -> PathBuf
Get the default config file path.
Sourcepub fn state_dir() -> PathBuf
pub fn state_dir() -> PathBuf
Get the OpenClaw state directory.
Uses OPENCLAW_STATE_DIR env var if set, otherwise ~/.openclaw.
Sourcepub fn credentials_dir() -> PathBuf
pub fn credentials_dir() -> PathBuf
Get the credentials directory.
Sourcepub fn sessions_dir() -> PathBuf
pub fn sessions_dir() -> PathBuf
Get the sessions directory.
Sourcepub fn agents_dir() -> PathBuf
pub fn agents_dir() -> PathBuf
Get the agents directory.
Sourcepub fn get_agent(&self, id: &str) -> AgentConfig
pub fn get_agent(&self, id: &str) -> AgentConfig
Get agent config by ID, falling back to default.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
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
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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