Update for optimize COMPONENTS adding

This commit is contained in:
timqiu 2025-04-07 16:09:46 +08:00
parent 1e4aef9dda
commit 84a53c75d3

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Modifying it manually is not recommended # Modifying it manually is not recommended
# All components that can be started in the DevBox container. [COMPONENT_SETTINGS] # All components that can be started in the DevBox container. [:COMPONENT_SETTINGS]
DEVBOX_COMPONENTS=("devsvc" "notification" "content" "central_storage" "chat" "authentication") DEVBOX_COMPONENTS=("devsvc" "notification" "content" "central_storage" "chat" "authentication")
log_info() { log_info() {
@ -641,8 +641,8 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
export DEVBOX_FRONTEND_PORT="${DEVBOX_FRONTEND_PORT}" export DEVBOX_FRONTEND_PORT="${DEVBOX_FRONTEND_PORT}"
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') USE_LOCAL_COMPONENT_VAL: ${USE_LOCAL_COMPONENT_VAL}" echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') USE_LOCAL_COMPONENT_VAL: ${USE_LOCAL_COMPONENT_VAL}"
# Check if the working home directory exists, if not, create it # Check if the working home directory exists, if not, create it. [:COMPONENT_SETTINGS]
if [[ "$USE_LOCAL_COMPONENT_VAL" == "true" ]]; then if [[ "$USE_LOCAL_COMPONENT_VAL" == "true" ]]; then
# Local component environment variables # Local component environment variables
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Use local component dev environment." echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Use local component dev environment."
cat << 'EOFinner' > /home/devbox/freeleaps/apps/.env cat << 'EOFinner' > /home/devbox/freeleaps/apps/.env
@ -671,13 +671,13 @@ if [[ "$USE_LOCAL_COMPONENT_VAL" == "true" ]]; then
export EMAIL_FROM=freeleaps@freeleaps.com export EMAIL_FROM=freeleaps@freeleaps.com
export VITE_PROXY_WEBSOCKET_CHAT_URL=ws://localhost:8012 export VITE_PROXY_WEBSOCKET_CHAT_URL=ws://localhost:8012
export VITE_PROXY_API_CHAT_URL=http://localhost:8012 export VITE_PROXY_API_CHAT_URL=http://localhost:8012
EOFinner EOFinner
# Update set VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development # Update set VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Update VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development" echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Update VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development"
sed -i "s|VITE_PROXY_WEBSOCKET_CHAT_URL=.*|VITE_PROXY_WEBSOCKET_CHAT_URL=ws://chat:8012|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development sed -i "s|VITE_PROXY_WEBSOCKET_CHAT_URL=.*|VITE_PROXY_WEBSOCKET_CHAT_URL=ws://chat:8012|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development
sed -i "s|VITE_PROXY_API_CHAT_URL=.*|VITE_PROXY_API_CHAT_URL=http://chat:8012|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development sed -i "s|VITE_PROXY_API_CHAT_URL=.*|VITE_PROXY_API_CHAT_URL=http://chat:8012|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development
else else
# Online component environment variables # Online component environment variables
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Use online component dev environment." echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Use online component dev environment."
cat << 'EOFinner' > /home/devbox/freeleaps/apps/.env cat << 'EOFinner' > /home/devbox/freeleaps/apps/.env
@ -705,14 +705,14 @@ else
export REDIS_URL=redis://freeleaps2-redis:6379/0 export REDIS_URL=redis://freeleaps2-redis:6379/0
export VITE_PROXY_WEBSOCKET_CHAT_URL=wss://freeleaps-alpha.com export VITE_PROXY_WEBSOCKET_CHAT_URL=wss://freeleaps-alpha.com
export VITE_PROXY_API_CHAT_URL=https://freeleaps-alpha.com export VITE_PROXY_API_CHAT_URL=https://freeleaps-alpha.com
EOFinner EOFinner
# Update set VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development # Update set VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Update VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development" echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Update VITE_PROXY_WEBSOCKET_CHAT_URL and VITE_PROXY_API_CHAT_URL in frontend/.env.development"
sed -i "s|VITE_PROXY_WEBSOCKET_CHAT_URL=.*|VITE_PROXY_WEBSOCKET_CHAT_URL=wss://freeleaps-alpha.com|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development sed -i "s|VITE_PROXY_WEBSOCKET_CHAT_URL=.*|VITE_PROXY_WEBSOCKET_CHAT_URL=wss://freeleaps-alpha.com|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development
sed -i "s|VITE_PROXY_API_CHAT_URL=.*|VITE_PROXY_API_CHAT_URL=https://freeleaps-alpha.com|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development sed -i "s|VITE_PROXY_API_CHAT_URL=.*|VITE_PROXY_API_CHAT_URL=https://freeleaps-alpha.com|g" /home/devbox/freeleaps/frontend/freeleaps/.env.development
echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Online component dev environment variables set." echo "[INIT] \$(date '+%Y-%m-%d %H:%M:%S') Online component dev environment variables set."
fi fi
if true ; then if true ; then
# Git configuration to skip worktree for .env file # Git configuration to skip worktree for .env file
@ -1341,6 +1341,7 @@ docker exec -i "$DEVBOX_NAME" bash <<EOF
exit 1 exit 1
fi fi
# Frontend environment variable settings. [:COMPONENT_SETTINGS]
echo "[FRONTEND] \$(date '+%Y-%m-%d %H:%M:%S') USE_LOCAL_COMPONENT_VAL: \$USE_LOCAL_COMPONENT_VAL" echo "[FRONTEND] \$(date '+%Y-%m-%d %H:%M:%S') USE_LOCAL_COMPONENT_VAL: \$USE_LOCAL_COMPONENT_VAL"
if [[ "\$USE_LOCAL_COMPONENT_VAL" == "true" ]]; then if [[ "\$USE_LOCAL_COMPONENT_VAL" == "true" ]]; then
echo "[FRONTEND] \$(date '+%Y-%m-%d %H:%M:%S') Use local component dev environment." echo "[FRONTEND] \$(date '+%Y-%m-%d %H:%M:%S') Use local component dev environment."