Skip to main content

init

Function init 

Source
pub fn init(config: Config) -> Result<()>
Expand description

Initialize the Detrix client.

This starts the control plane HTTP server but does NOT contact the daemon. The client starts in SLEEPING state with zero overhead.

§Configuration

Configuration can be provided via the Config struct or environment variables:

  • DETRIX_NAME - Connection name
  • DETRIX_DAEMON_URL - Daemon URL
  • DETRIX_CONTROL_HOST - Control plane bind host
  • DETRIX_CONTROL_PORT - Control plane port
  • DETRIX_DEBUG_PORT - Debug adapter port
  • DETRIX_LLDB_DAP_PATH - Path to lldb-dap binary
  • DETRIX_HOME - Detrix home directory
  • DETRIX_HEALTH_CHECK_TIMEOUT - Health check timeout (seconds, e.g. “2.0”)
  • DETRIX_REGISTER_TIMEOUT - Registration timeout (seconds, e.g. “5.0”)
  • DETRIX_UNREGISTER_TIMEOUT - Unregistration timeout (seconds, e.g. “2.0”)

§Errors

Returns an error if:

  • Client is already initialized
  • lldb-dap binary not found
  • Failed to start control plane

§Example

use detrix_rs::{self, Config};

detrix_rs::init(Config {
    name: Some("my-service".to_string()),
    ..Config::default()
})?;