aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2023-01-17 15:24:40 +0100
committerKarel Kočí <cynerd@email.cz>2023-01-17 15:24:40 +0100
commit2a72895d7a7be71d6eefee193ce22e80718ee253 (patch)
tree46354a2326aea1b59a06adbe1717ca6b0a85a418
parent7bbabda1de2a0331d205b9cc030780faf39f795a (diff)
downloadnixos-personal-2a72895d7a7be71d6eefee193ce22e80718ee253.tar.gz
nixos-personal-2a72895d7a7be71d6eefee193ce22e80718ee253.tar.bz2
nixos-personal-2a72895d7a7be71d6eefee193ce22e80718ee253.zip
tools/influxdb-monitoring.sh: fix token creation
-rwxr-xr-xtools/influxdb-monitoring.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/influxdb-monitoring.sh b/tools/influxdb-monitoring.sh
index f83f792..612900f 100755
--- a/tools/influxdb-monitoring.sh
+++ b/tools/influxdb-monitoring.sh
@@ -3,7 +3,7 @@
# telemetries.
set -eu
-if ! command -v influx jq pass; then
+if ! command -v influx >/dev/null || ! command -v jq >/dev/null || ! command -v pass >/dev/null; then
exec nix shell 'nixpkgs#influxdb2' 'nixpkgs#jq' 'nixpkgs#pass' -c "$0" "$@"
fi
@@ -31,7 +31,7 @@ ensure_token() {
pass_path="nixos-secrets/influxdb/token/$hostname"
if ! token="$(pass "$pass_path" 2>/dev/null)" \
|| ! token_is_valid "$token"; then
- influx auth create -d "monitoring-$hostname" --write-buckets --json \
+ influx auth create "${influx_args[@]}" -o "personal" -d "monitoring-$hostname" --write-buckets --json \
| jq -r '.token' \
| sed 's/^\(.*\)$/\1\n\1/' \
| pass insert -f "$pass_path"