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(-)
@@ -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
@@ -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)
},