🏡 index : ~doyle/pisshoff.git

author Jordan Doyle <jordan@doyle.la> 2023-06-27 2:42:13.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2023-06-27 2:42:13.0 +01:00:00
commit
1fa1ba16c156a3076433dd6faa68b841304052c8 [patch]
tree
fb2ca7132fa8737d64d8eadb9eb36b5a3beefc10
parent
21b2a0ac587dff8cade92c861d68391068315b48
download
1fa1ba16c156a3076433dd6faa68b841304052c8.tar.gz

Fix environment variable ingestion



Diff

 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
+++ a/pisshoff-server/src/command.rs
@@ -80,7 +80,7 @@
                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
+++ a/pisshoff-timescaledb-exporter/src/main.rs
@@ -108,11 +108,12 @@
        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)
        },