/ src / temporal.rs
temporal.rs
 1  use anyhow::Result;
 2  use temporal_client::{Client, RetryClient};
 3  use temporal_sdk::sdk_client_options;
 4  use temporal_sdk_core::Url;
 5  use tracing::info;
 6  
 7  pub async fn get_client() -> Result<RetryClient<Client>> {
 8      info!("connecting to Temporal");
 9      let temporal_url = std::env::var("TEMPORAL_URL").unwrap_or("http://localhost:7233".to_string());
10      let server_options = sdk_client_options(Url::parse(&temporal_url)?).build()?;
11      let client = server_options.connect("default", None).await?;
12      info!("connected to Temporal");
13  
14      Ok(client)
15  }