From a7b7164fc09cbe09417ff021eef67c3afff78353 Mon Sep 17 00:00:00 2001 From: devops Date: Thu, 15 Oct 2026 06:32:21 +0000 Subject: [PATCH] fix(support-chat): sync backend key with bot at deploy --- scripts/deploy.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index bd1e7d73..81ba4bf2 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -67,6 +67,20 @@ fi cd "$TARGET_DIR" # Inject support-chat runtime configuration from CI/CD without committing secrets. +# The bot is the runtime owner of the internal key; synchronize only the +# matching value into the colocated backend env file, never into Git or logs. +BOT_ENV="/opt/services/ai/canina-bot/support.env" +if [ -r "$BOT_ENV" ]; then + BOT_KEY=$(awk -F= '$1 == "SUPPORT_INTERNAL_KEY" {print substr($0, index($0, "=") + 1); exit}' "$BOT_ENV") + if [ -n "$BOT_KEY" ]; then + touch .support-chat.env + grep -v '^SUPPORT_CHAT_KEY=' .support-chat.env > .support-chat.env.tmp || true + printf "SUPPORT_CHAT_KEY=%s\n" "$BOT_KEY" >> .support-chat.env.tmp + mv .support-chat.env.tmp .support-chat.env + chmod 600 .support-chat.env + fi + unset BOT_KEY +fi if [ "${SUPPORT_CHAT_KEY+x}" = x ]; then touch .support-chat.env grep -v '^SUPPORT_CHAT_KEY=' .support-chat.env > .support-chat.env.tmp || true