use posthog_rs::{ClientOptionsBuilder, EU_INGESTION_ENDPOINT};
#[cfg(feature = "async-client")]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("=== PostHog SDK Configuration Examples ===\n");
println!("1. Basic client (US region):");
let _basic = posthog_rs::client("phc_test_api_key").await;
println!(" → Created with default settings\n");
println!("2. EU region client:");
let _eu = posthog_rs::client(("phc_test_api_key", EU_INGESTION_ENDPOINT)).await;
println!(" → Data stays in EU (GDPR compliant)\n");
println!("3. Self-hosted instance:");
let _custom = posthog_rs::client(("phc_test_api_key", "https://analytics.mycompany.com")).await;
println!(" → Uses your private PostHog deployment\n");
println!("4. Production configuration:");
let production_config = ClientOptionsBuilder::default()
.api_key("phc_production_key".to_string())
.host("https://eu.posthog.com") .request_timeout_seconds(30) .disable_geoip(true) .build()?;
let _prod = posthog_rs::client(production_config).await;
println!(" → Optimized for production workloads\n");
println!("5. High-performance with local evaluation:");
let performance_config = ClientOptionsBuilder::default()
.api_key("phc_project_key".to_string())
.personal_api_key("phx_personal_key") .enable_local_evaluation(true) .poll_interval_seconds(30) .feature_flags_request_timeout_seconds(3)
.build()?;
let _perf = posthog_rs::client(performance_config).await;
println!(" → Evaluates flags locally (100x faster)\n");
println!("Configuration examples complete!");
println!("\nTip: Check out 'feature_flags' example for flag usage");
println!(" and 'local_evaluation' for performance optimization.");
Ok(())
}
#[cfg(not(feature = "async-client"))]
fn main() {
println!("This example requires the async-client feature.");
println!("Run with: cargo run --example advanced_config --features async-client");
}