#!/bin/sh
# usage: ./rcli USER ARGS...  runs redis-cli in the redis container as the ACL user USER.
# The password is read from the secret file inside the container, so it never appears in a host
# command line or in redis-cli's arguments.
user=$1; shift
exec docker compose exec -T redis sh -c \
  'REDISCLI_AUTH="$(cat "/run/secrets/redis_${0}_password")" exec redis-cli --user "$0" "$@"' "$user" "$@"
