#!/bin/sh
set -eu

# Used to expand environment variables and pass them to redis command line.
# This is because setting `command` in the docker-compose yaml with environment
# variables inside of it will not expand them from the declared `environment`
# section, but rather only from the system's shell that invoked the docker-compose cmd.

redis-server \
  --appendonly yes \
  --user "$REDIS_USER" on ">$REDIS_PASSWORD" ~* allcommands \
  --user default off nopass nocommands \
  --maxmemory "$REDIS_MAX_MEMORY" \
  --maxmemory-policy allkeys-lru
