Skip to content

Commit 23abde6

Browse files
committed
fix(entrypoint): improve Redis connection string handling and logging
- Added provenance tracking for the original Redis connection string to enhance logging clarity. - Updated logging to differentiate between direct environment variable usage and aliased variables for better traceability. These changes improve the visibility of Redis connection configurations during startup, aiding in debugging and monitoring. Signed-off-by: Innei <tukon479@gmail.com>
1 parent 729924d commit 23abde6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docker-entrypoint.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,14 @@ mask_redis_password() {
7676
# - `--config` -> CONFIG
7777
# - `--collection_name` -> COLLECTION_NAME
7878
# - `--http_request_verbose` -> HTTP_REQUEST_VERBOSE
79+
#
80+
# Keep a tiny bit of provenance for logs.
81+
REDIS_CONNECTION_STRING_ORIG="${REDIS_CONNECTION_STRING:-}"
7982
apply_env_alias CONFIG CONFIG_PATH
8083
apply_env_alias COLLECTION_NAME DB_COLLECTION_NAME
8184
apply_env_alias HTTP_REQUEST_VERBOSE DEBUG
85+
# Redis env compatibility: keep consistent with DB's `MONGO_CONNECTION` handling.
86+
apply_env_alias REDIS_CONNECTION_STRING REDIS_CONNECTION
8287

8388
echo "Starting Mix Space"
8489
echo "============== Entrypoint =============="
@@ -122,7 +127,11 @@ fi
122127

123128
# Redis summary
124129
if [ -n "${REDIS_CONNECTION_STRING:-}" ]; then
125-
log_kv "Redis" "$(mask_redis_password "$REDIS_CONNECTION_STRING")" "env:REDIS_CONNECTION_STRING"
130+
redis_conn_source="env:REDIS_CONNECTION_STRING"
131+
if [ -z "$REDIS_CONNECTION_STRING_ORIG" ] && [ -n "${REDIS_CONNECTION:-}" ]; then
132+
redis_conn_source="env:REDIS_CONNECTION (aliased to REDIS_CONNECTION_STRING)"
133+
fi
134+
log_kv "Redis" "$(mask_redis_password "$REDIS_CONNECTION_STRING")" "$redis_conn_source"
126135
else
127136
redis_host="${REDIS_HOST:-127.0.0.1}"
128137
redis_port="${REDIS_PORT:-6379}"

0 commit comments

Comments
 (0)