Skip to content

Commit

Permalink
Add dev scripts for inspecting redis streams
Browse files Browse the repository at this point in the history
  • Loading branch information
eikek committed Sep 5, 2024
1 parent 275e2a3 commit 67e9ec5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nix/dev-scripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
inherit system;
};

redis-list-streams = devshell-tools.lib.installScript {
script = ./scripts/redis-list-streams;
inherit system;
};

redis-stream-info = devshell-tools.lib.installScript {
script = ./scripts/redis-stream-info;
inherit system;
};

k8s-reprovision = devshell-tools.lib.installScript {
script = ./scripts/k8s-reprovision;
inherit system;
Expand Down
20 changes: 20 additions & 0 deletions nix/scripts/redis-list-streams
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

host="${RS_REDIS_HOST:-localhost}"
if [ -n "$1" ]; then
host="$1"
fi
port="${RS_REDIS_PORT:-6379}"
if [ -n "$2" ]; then
port="$2"
fi
db_opt=""
if [ -n "$RS_REDIS_DB" ]; then
db_opt="-n $RS_REDIS_DB"
fi
db_pass=""
if [ -n "$RS_REDIS_PASSWORD" ]; then
db_pass="-a $RS_REDIS_PASSWORD"
fi

redis-cli -e --json -h "$host" -p "$port" $db_opt $db_pass scan 0 type stream | jq -r '.[1][]'
13 changes: 13 additions & 0 deletions nix/scripts/redis-stream-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

host="${RS_REDIS_HOST:-localhost}"
port="${RS_REDIS_PORT:-6379}"
db_opt=""
if [ -n "$RS_REDIS_DB" ]; then
db_opt="-n $RS_REDIS_DB"
fi
db_pass=""
if [ -n "$RS_REDIS_PASSWORD" ]; then
db_pass="-a $RS_REDIS_PASSWORD"
fi
redis-cli -e --json -h "$host" -p "$port" $db_opt $db_pass XINFO STREAM "$1"

0 comments on commit 67e9ec5

Please sign in to comment.