Skip to content

Commit 8073c85

Browse files
committed
cleanup
1 parent c868bc2 commit 8073c85

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

examples/webhooks/src/main.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ async fn main() {
6565
info!("🚀 Starting OpenAI Webhook Example");
6666
info!("");
6767

68-
// Check for API key
69-
let api_key = match std::env::var("OPENAI_API_KEY") {
70-
Ok(key) => key,
71-
Err(_) => {
72-
error!("❌ OPENAI_API_KEY environment variable not set!");
73-
error!(" Please set it with: export OPENAI_API_KEY=\"your-api-key\"");
74-
std::process::exit(1);
75-
}
76-
};
77-
7868
// Get webhook secret from environment
7969
let webhook_secret = std::env::var("OPENAI_WEBHOOK_SECRET").unwrap_or_else(|_| {
8070
warn!("⚠️ OPENAI_WEBHOOK_SECRET not set, using default test secret");
@@ -116,7 +106,6 @@ async fn main() {
116106
info!("🔄 Sending background response request in 3 seconds...");
117107

118108
// Spawn a task to send the background response request
119-
let api_key_clone = api_key.clone();
120109
tokio::spawn(async move {
121110
// Wait for server to be ready
122111
tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
@@ -126,7 +115,7 @@ async fn main() {
126115
info!("📤 Sending background response request...");
127116
info!("");
128117

129-
match send_background_response(&api_key_clone).await {
118+
match send_background_response().await {
130119
Ok(response_id) => {
131120
info!("✅ Background response created successfully!");
132121
info!(" Response ID: {}", response_id);
@@ -147,7 +136,7 @@ async fn main() {
147136
}
148137

149138
/// Send a background response request to OpenAI using async-openai client
150-
async fn send_background_response(_api_key: &str) -> Result<String, Box<dyn std::error::Error>> {
139+
async fn send_background_response() -> Result<String, Box<dyn std::error::Error>> {
151140
// Create OpenAI client (will use OPENAI_API_KEY env var)
152141
let client = Client::new();
153142

0 commit comments

Comments
 (0)