diff --git a/.env.example b/.env.example index cc910f5..dbbe65a 100644 --- a/.env.example +++ b/.env.example @@ -6,3 +6,5 @@ ES_VERIFY_SSL=true SCHEDULER_ENABLED=false SCHEDULER_HOUR=3 + +HOST_ATUACAPES=https://atuacapes.capes.gov.br \ No newline at end of file diff --git a/backend/.env.example b/backend/.env.example index c135381..ce549fd 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,18 +1,17 @@ ES_URL=http://localhost:9200 -ES_INDEX=atuacapes__1763197236 +ES_INDEX=atuacapes ES_USER=seu_usuario_elastic ES_PASSWORD=sua_senha_elastic -ES_VERIFY_SSL=true +ES_PASS=sua_senha_elastic -ORACLE_LOCAL_USER=ranking -ORACLE_LOCAL_PASSWORD=senha_oracle -ORACLE_LOCAL_DSN=localhost:1521/XEPDB1 +ORACLE_USER=seu_usuario_oracle +ORACLE_PASSWORD=sua_senha_oracle +ORACLE_DSN=oracle:1521/XEPDB1 -API_HOST=0.0.0.0 -API_PORT=8000 -API_RELOAD=true -CORS_ORIGINS=http://localhost:3000,http://localhost:5173 +ORACLE_LOCAL_USER=seu_usuario_local +ORACLE_LOCAL_PASSWORD=sua_senha_local +ORACLE_LOCAL_DSN=XEPDB1 -LOG_LEVEL=INFO -SCHEDULER_ENABLED=false -SCHEDULER_HOUR=3 +ORACLE_CLIENT=oracle-local + +HOST_ATUACAPES=https://atuacapes.capes.gov.br diff --git a/docker-compose.yml b/docker-compose.yml index 7b8977e..f337d65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,6 +36,8 @@ services: - backend ports: - "5173:5173" + environment: + - VITE_HOST_ATUACAPES=${HOST_ATUACAPES:-https://atuacapes.capes.gov.br} volumes: - ./frontend/src:/app/src - ./frontend/index.html:/app/index.html diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 0000000..d8b61f6 --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1,2 @@ +VITE_API_URL=http://localhost:8010/api/v1 +VITE_HOST_ATUACAPES=https://atuacapes.capes.gov.br diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index b5deae9..d7259e5 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -44,7 +44,10 @@ function App() { loadRanking(); }, [page, pageSize]); - const loadRanking = async () => { + const loadRanking = async (retryCount = 0) => { + const MAX_RETRIES = 10; + const RETRY_DELAY = 2000; + try { setLoading(true); setError(null); @@ -56,6 +59,14 @@ function App() { setPage(response.page || page); } catch (err) { const status = err?.response?.status; + const isNetworkError = !err?.response || err?.code === 'ERR_NETWORK'; + + if (isNetworkError && retryCount < MAX_RETRIES) { + setProcessMessage(`Aguardando API... (tentativa ${retryCount + 1}/${MAX_RETRIES})`); + await new Promise((r) => setTimeout(r, RETRY_DELAY)); + return loadRanking(retryCount + 1); + } + if (status === 503) { try { setProcessing(true); @@ -146,7 +157,7 @@ function App() { return (