Files
mtusi2026lab7/infra/redis/start-redis.sh
T
gytall 0b97f77d76
Skeleton contracts / contracts (pull_request) Canceled after 0s
skeleton lab7 and tasks for grade 3
2026-11-21 16:21:47 +03:00

17 lines
738 B
Bash

#!/bin/sh
set -eu
password_hash=$(tr -d '\r\n' </run/secrets/redis_password | sha256sum | cut -d ' ' -f 1)
mkdir -p /run/redis
umask 077
printf 'user session on #%s ~session:* +get +set +del +ping +hello +select +client|setinfo\n' "$password_hash" >/run/redis/users.acl
if [ -r /run/secrets/test_redis_password ]; then
test_hash=$(sha256sum </run/secrets/test_redis_password | cut -d ' ' -f 1)
printf 'user default reset on #%s ~* &* +@all\n' "$test_hash" >>/run/redis/users.acl
else
printf 'user default off\n' >>/run/redis/users.acl
fi
chown redis:redis /run/redis/users.acl
chmod 600 /run/redis/users.acl
exec /usr/local/bin/docker-entrypoint.sh redis-server /usr/local/etc/redis/redis.conf --aclfile /run/redis/users.acl