mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 03:52:26 +08:00
fix(deploy): 用 exec 列表形式重写 redis command
参数逐项传递,不再经 sh 拼接,避免密码含 shell 特殊字符时被展开或截断; 空密码时按 redis 语义不设密码。
This commit is contained in:
@@ -147,17 +147,17 @@ 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_PASSWORD:+--requirepass "$REDIS_PASSWORD"}'
|
||||
command:
|
||||
- redis-server
|
||||
- --save
|
||||
- "60"
|
||||
- "1"
|
||||
- --appendonly
|
||||
- "yes"
|
||||
- --appendfsync
|
||||
- everysec
|
||||
- --requirepass
|
||||
- ${REDIS_PASSWORD:-}
|
||||
environment:
|
||||
- TZ=${TZ:-Asia/Shanghai}
|
||||
- REDISCLI_AUTH=${REDIS_PASSWORD:-}
|
||||
|
||||
@@ -264,17 +264,17 @@ services:
|
||||
volumes:
|
||||
# Local directory mapping for easy migration
|
||||
- ./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_PASSWORD:+--requirepass "$REDIS_PASSWORD"}'
|
||||
command:
|
||||
- redis-server
|
||||
- --save
|
||||
- "60"
|
||||
- "1"
|
||||
- --appendonly
|
||||
- "yes"
|
||||
- --appendfsync
|
||||
- everysec
|
||||
- --requirepass
|
||||
- ${REDIS_PASSWORD:-}
|
||||
environment:
|
||||
- TZ=${TZ:-Asia/Shanghai}
|
||||
# REDISCLI_AUTH is used by redis-cli for authentication (safer than -a flag)
|
||||
|
||||
+11
-11
@@ -287,17 +287,17 @@ services:
|
||||
hard: 100000
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
# 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_PASSWORD:+--requirepass "$REDIS_PASSWORD"}'
|
||||
command:
|
||||
- redis-server
|
||||
- --save
|
||||
- "60"
|
||||
- "1"
|
||||
- --appendonly
|
||||
- "yes"
|
||||
- --appendfsync
|
||||
- everysec
|
||||
- --requirepass
|
||||
- ${REDIS_PASSWORD:-}
|
||||
environment:
|
||||
- TZ=${TZ:-Asia/Shanghai}
|
||||
# REDISCLI_AUTH is used by redis-cli for authentication (safer than -a flag)
|
||||
|
||||
Reference in New Issue
Block a user