Files
bi-agents/docker-entrypoint.sh
root 7ee15ad5e5 feat: trading terminal live rates + fix spread negativo + fix USD→BRL
- Adiciona widget de cotações ao vivo (USD/BRL e EUR/BRL) com design
  estilo terminal de trading (dark theme, tipografia mono, glow effects)
- Proxy server-side /api/cotacao com cache 3s e token AwesomeAPI
- Auto-refresh a cada 3 segundos apenas quando a página está aberta
- Corrige cálculo de spread negativo: remove Math.abs() em USD→BRL
  e Math.max(0,...) no spread líquido
- Corrige seção USD→BRL que não aparecia (filtro status !== 'finalizado')
- Corrige valor_reais no fluxo USD→BRL: agora calcula valor * cotação
- Adiciona classe CSS spread-negative para destacar spreads negativos
- Bandeiras de fluxo (BR/US/EU) nos botões de compra e venda

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:30:43 -05:00

40 lines
1.3 KiB
Bash

#!/bin/bash
set -e
echo "=== BI Agentes Startup ==="
# Check for Netbird setup key
if [ -n "$NETBIRD_SETUP_KEY" ]; then
echo "Connecting to Netbird network..."
echo "Management URL: ${NETBIRD_MANAGEMENT_URL:-https://netbird.cambioreal.com}"
# Start netbird daemon directly (not via systemd - doesn't work in containers)
MGMT_URL="${NETBIRD_MANAGEMENT_URL:-https://netbird.cambioreal.com}"
# Run netbird daemon in background
netbird service run &
sleep 3
# Connect using setup key and management URL
# Use custom hostname for stable DNS name (default: bi-ccc)
NETBIRD_HOSTNAME="${NETBIRD_HOSTNAME:-bi-ccc}"
netbird up --setup-key "$NETBIRD_SETUP_KEY" --management-url "$MGMT_URL" --hostname "$NETBIRD_HOSTNAME" &
# Wait for connection
echo "Waiting for Netbird connection..."
sleep 10
# Check connection status
netbird status || echo "Netbird connection pending..."
# Add route for local network to bypass VPN tunnel
# This ensures responses to LAN clients go via Docker bridge, not VPN
echo "Adding local network route..."
ip route add 192.168.88.0/24 via 172.23.0.1 dev eth0 2>/dev/null || true
else
echo "WARNING: NETBIRD_SETUP_KEY not set. Database connection may fail."
fi
echo "Starting BI Agentes server..."
exec node server.js