From 1fa1ba16c156a3076433dd6faa68b841304052c8 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Tue, 27 Jun 2023 02:42:13 +0100 Subject: [PATCH] Fix environment variable ingestion --- pisshoff-server/src/command.rs | 2 +- pisshoff-timescaledb-exporter/src/main.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pisshoff-server/src/command.rs b/pisshoff-server/src/command.rs index 36fa090..1f789d8 100644 --- a/pisshoff-server/src/command.rs +++ b/pisshoff-server/src/command.rs @@ -80,7 +80,7 @@ or available locally via: info '(coreutils) uname invocation'\n".into(), Some("-") => "uname: extra operand '-'\nTry 'uname --help' for more information.\n".into(), Some(v) => format!( "uname: invalid option -- '{}'\nTry 'uname --help' for more information.\n", - if v.starts_with("-") && !v.starts_with("--") { + if v.starts_with('-') && !v.starts_with("--") { &v[1..] } else { v diff --git a/pisshoff-timescaledb-exporter/src/main.rs b/pisshoff-timescaledb-exporter/src/main.rs index 9cce26a..b9bf8b2 100644 --- a/pisshoff-timescaledb-exporter/src/main.rs +++ b/pisshoff-timescaledb-exporter/src/main.rs @@ -108,11 +108,12 @@ async fn ingest_log(context: Arc, line: String) -> anyhow::Result<()> { async { let prepared = tx.prepare("INSERT INTO audit_environment_variables (connection_id, name, value) VALUES ($1, $2, $3)").await?; - futures::future::try_join_all( - line.environment_variables - .iter() - .map(|(key, value)| async { tx.execute(&prepared, &[key, value]).await }), - ) + futures::future::try_join_all(line.environment_variables.iter().map( + |(key, value)| async { + tx.execute(&prepared, &[&line.connection_id, key, value]) + .await + }, + )) .await .map_err(anyhow::Error::from) }, -- libgit2 1.7.2