Skip to content

feat: secure redis env config for VPS - #75

Merged
Benevanio merged 10 commits into
developfrom
feature/redis-config
Apr 9, 2026
Merged

Benevanio merged 10 commits into
developfrom
feature/redis-config

Conversation

@Benevanio

Copy link
Copy Markdown
Collaborator

No description provided.

@vercel

vercel Bot commented Apr 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
painel-vagas Ready Ready Preview, Comment Apr 9, 2026 10:00pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a more VPS/open-source-friendly configuration approach by allowing keywords to be sourced from environment variables (instead of a committed JSON file) and adds an optional Redis-backed cache implementation for job search caching.

Changes:

  • Add KEYWORDS_STORAGE_MODE=env|file to control whether keywords are read/written via SEARCH_KEYWORDS env var or backend/src/db/environment.json.
  • Introduce a Redis cache implementation (fallbacks to in-memory) and update the cache call sites to support async cache operations.
  • Update docs, docker-compose defaults, .env.example, and add/adjust unit + integration tests.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Documents safer VPS config guidance for Redis/Postgres + env-based keywords
docker-compose.yml Adds env defaults for keywords mode and cache-related env vars
backend/.env.example Adds examples for KEYWORDS_STORAGE_MODE, Redis, DB, TTL, prefix
backend/package.json Adds redis dependency
package-lock.json Locks redis and its transitive deps
backend/src/config.js Adds keywords storage mode logic + new env-derived config fields
backend/src/jobsApiApp.js Supports env-mode keyword read/write for /api/keywords
backend/src/cache/cache.js Adds RedisCache with memory fallback and lazy client init
backend/src/pipeline/searchJobsWithCache.js Awaits cache operations for Redis compatibility
backend/tests/unit/utils/config.test.js Adds coverage for env-mode priority behavior
backend/tests/integration/jobsApi.test.js Adds coverage for /api/keywords behavior in env mode

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker-compose.yml
Comment thread backend/src/config.js Outdated
Comment on lines +77 to +95
@@ -63,20 +92,15 @@ function parseKeywords(value) {
return normalizeKeywords(data.KEYWORDS) ?? [];
}
}
} catch (err) {
} catch {

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseKeywords() ainda tenta ler environment.json mesmo quando KEYWORDS_STORAGE_MODE=env se SEARCH_KEYWORDS estiver vazio/undefined (porque parseKeywordsFromEnv retorna null e o fluxo cai no bloco do arquivo). Isso contradiz o comportamento em jobsApiApp.readEnvironmentData() (que, em modo env, nunca consulta arquivo) e pode reintroduzir dependência do JSON em produção. Ajuste sugerido: em modo env, não ler arquivo; faça fallback direto para DEFAULT_KEYWORDS (ou [], conforme regra desejada) quando SEARCH_KEYWORDS não tiver valores.

Copilot uses AI. Check for mistakes.
Comment thread backend/src/config.js Outdated
Comment thread backend/src/jobsApiApp.js Outdated
Benevanio and others added 3 commits April 9, 2026 12:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Benevanio <benevaniosantos930@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Benevanio <benevaniosantos930@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Benevanio <benevaniosantos930@gmail.com>
@Benevanio
Benevanio merged commit 8826339 into develop Apr 9, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in JobAtlas – Kanban Apr 9, 2026

This branch was previously deployed

1 inactive deployment
Preview — 41cdc808 Deployed Apr 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants