fix(support-chat): sync backend key with bot at deploy
Deploy Canina / deploy (push) Failing after 16s

This commit is contained in:
devops committed 2026-10-15 06:32:21 +00:00
1 parent 73f5d6d278
commit a7b7164fc0
1 file changed
+14
+14
View File
@@ -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