mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 14:18:44 +08:00
fix(deploy): make the redis command flags take effect in dev and local compose
PR #4506 fixed this in deploy/docker-compose.yml, but the same broken form is still in docker-compose.dev.yml and docker-compose.local.yml. The redis command is one quoted script given to the inner sh -c, and compose keeps the newlines inside the quoted string, so redis-server on the first line runs as a complete command with no flags at all. The --save / --appendonly / --appendfsync lines are silently never applied, and ${REDIS_PASSWORD:+--requirepass ...} is dead too — redis takes no password even when REDIS_PASSWORD is set. The fix is the same trailing `\` line continuations as #4506, with the same comment, so the three compose files read the same way. Checked with both files on redis:8-alpine, REDIS_PASSWORD set. Before: PING with no auth said PONG, appendonly was "no", save was the stock "3600 1 300 100 60 10000". After: no-auth PING gets NOAUTH, appendonly is "yes", save is "60 1". With REDIS_PASSWORD unset the server still starts open, as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -114,12 +114,16 @@ services:
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./redis_data:/data:Z
|
||||
# The command is one quoted script for the inner `sh -c`. Compose keeps
|
||||
# the newlines inside the quoted string, so every line needs a trailing
|
||||
# `\` — without it, `redis-server` on the first line runs with no flags
|
||||
# at all, and the --save/--appendonly/--appendfsync lines are never read.
|
||||
command: >
|
||||
sh -c '
|
||||
redis-server
|
||||
--save 60 1
|
||||
--appendonly yes
|
||||
--appendfsync everysec
|
||||
redis-server \
|
||||
--save 60 1 \
|
||||
--appendonly yes \
|
||||
--appendfsync everysec \
|
||||
${REDIS_PASSWORD:+--requirepass "$REDIS_PASSWORD"}'
|
||||
environment:
|
||||
- TZ=${TZ:-Asia/Shanghai}
|
||||
|
||||
Reference in New Issue
Block a user