From: Nick Porter Date: Mon, 11 May 2026 12:32:23 +0000 (+0100) Subject: Add -a option to redis-setup script X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b60f95b105b6fa0d273f1777dd84f435d0263ffc;p=thirdparty%2Ffreeradius-server.git Add -a option to redis-setup script To allow test cluster to use redis auth --- diff --git a/scripts/ci/redis-setup.sh b/scripts/ci/redis-setup.sh index bdce740f567..130a7b33663 100755 --- a/scripts/ci/redis-setup.sh +++ b/scripts/ci/redis-setup.sh @@ -1,5 +1,14 @@ #!/bin/bash -e +while getopts 'a:' opt; do + case "$opt" in + a) + PASSWORD="$OPTARG" + ;; + esac +done +shift $((OPTIND - 1)) + TMP_REDIS_DIR='/tmp/redis' REDIS_MAJOR_VERSION="$(redis-server -v | grep -o 'v=[0-9.]*' | cut -d= -f2 | cut -d. -f1)" @@ -29,6 +38,10 @@ if [ ! -e "${TMP_REDIS_DIR}/create-cluster" ]; then if [ "${REDIS_MAJOR_VERSION}" -ge 7 ]; then echo "ADDITIONAL_OPTIONS=\"--enable-debug-command local\"" > "${TMP_REDIS_DIR}/config.sh" fi + if [ "x$PASSWORD" != "x" ]; then + echo "AUTH_OPTIONS=\"--masterauth ${PASSWORD} --requirepass ${PASSWORD}\"" >> "${TMP_REDIS_DIR}/config.sh" + echo "export REDISCLI_AUTH=\"${PASSWORD}\"" >> "${TMP_REDIS_DIR}/config.sh" + fi fi # Fix hardcoded paths in the test script @@ -42,6 +55,8 @@ if [ "${REDIS_MAJOR_VERSION}" -lt 7 ]; then sed -ie "s#appendonlydir-\*#appendonly\*.aof#" "${TMP_REDIS_DIR}/create-cluster" fi +sed -ie "s#\${ADDITIONAL_OPTIONS}#\${ADDITIONAL_OPTIONS} \${AUTH_OPTIONS}#" "${TMP_REDIS_DIR}/create-cluster" + # Ensure all nodes are accessible before creating cluster if [ "$1" == "create" ]; then waits=0