feat(sync): add GoMag API client with Phase 0 auto-download

- New gomag_client.py service: async httpx client that downloads orders
  from GoMag API with full pagination and 1s rate-limit sleep
- config.py: add GOMAG_API_KEY, GOMAG_API_SHOP, GOMAG_ORDER_DAYS_BACK,
  GOMAG_LIMIT, GOMAG_API_URL settings
- sync_service.py: Phase 0 downloads fresh orders before reading JSONs;
  graceful skip if API keys not configured
- start.sh: auto-detect INSTANTCLIENTPATH from .env, fallback to thin mode
- .env.example: document GoMag API variables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-13 23:03:39 +00:00
parent 2e65855fe2
commit b69b5e7104
5 changed files with 140 additions and 3 deletions

22
start.sh Normal file → Executable file
View File

@@ -28,7 +28,27 @@ fi
# Oracle config
export TNS_ADMIN="$(pwd)/api"
export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_15:$LD_LIBRARY_PATH
# Detect Oracle Instant Client path from .env or use default
INSTANTCLIENT_PATH=""
if [ -f "api/.env" ]; then
INSTANTCLIENT_PATH=$(grep -E "^INSTANTCLIENTPATH=" api/.env | cut -d'=' -f2- | tr -d ' ')
fi
# Fallback to default path if not set in .env
if [ -z "$INSTANTCLIENT_PATH" ]; then
INSTANTCLIENT_PATH="/opt/oracle/instantclient_21_15"
fi
if [ -d "$INSTANTCLIENT_PATH" ]; then
echo "Oracle Instant Client found: $INSTANTCLIENT_PATH (thick mode)"
export LD_LIBRARY_PATH="$INSTANTCLIENT_PATH:$LD_LIBRARY_PATH"
else
echo "WARN: Oracle Instant Client NOT found la: $INSTANTCLIENT_PATH"
echo " Se va folosi thin mode (Oracle 12.1+ necesar)."
echo " Pentru thick mode: instaleaza instantclient sau seteaza INSTANTCLIENTPATH in api/.env"
# Force thin mode so app doesn't try to load missing libraries
export FORCE_THIN_MODE=true
fi
cd api
echo "Starting GoMag Import Manager on http://0.0.0.0:5003"