Revert "Use Cloudflare Turnstile secret env name"

This reverts commit e8eafaf9b9.
This commit is contained in:
Cauê Faleiros
2026-07-28 11:52:46 -03:00
parent e8eafaf9b9
commit 302b55b346
5 changed files with 9 additions and 9 deletions

View File

@@ -22,8 +22,8 @@ JWT_SECRET=super_secret_jwt_key_123
# --- CAPTCHA / Bot Protection (Optional) --- # --- CAPTCHA / Bot Protection (Optional) ---
# Create keys in Cloudflare Turnstile and set both values in production. # Create keys in Cloudflare Turnstile and set both values in production.
# When TURNSTILE_SECRET is empty, backend CAPTCHA enforcement is disabled. # When TURNSTILE_SECRET_KEY is empty, backend CAPTCHA enforcement is disabled.
TURNSTILE_SECRET= TURNSTILE_SECRET_KEY=
# --- Frontend Configuration (Optional) --- # --- Frontend Configuration (Optional) ---
# If you need to override the API URL for the frontend # If you need to override the API URL for the frontend

View File

@@ -112,11 +112,11 @@ N8N_WHATSAPP_TRIGGER_URL
ADMIN_EMAIL ADMIN_EMAIL
ADMIN_PASSWORD ADMIN_PASSWORD
JWT_SECRET JWT_SECRET
TURNSTILE_SECRET TURNSTILE_SECRET_KEY
VITE_TURNSTILE_SITE_KEY VITE_TURNSTILE_SITE_KEY
``` ```
`TURNSTILE_SECRET` enables backend CAPTCHA enforcement on `/api/login`. `TURNSTILE_SECRET_KEY` enables backend CAPTCHA enforcement on `/api/login`.
Set `VITE_TURNSTILE_SITE_KEY` at frontend build time to show Cloudflare Turnstile Set `VITE_TURNSTILE_SITE_KEY` at frontend build time to show Cloudflare Turnstile
on the login page. on the login page.

View File

@@ -8,5 +8,5 @@ module.exports = {
JWT_SECRET: process.env.JWT_SECRET || 'super_secret_jwt_key_123', JWT_SECRET: process.env.JWT_SECRET || 'super_secret_jwt_key_123',
DATABASE_URL: process.env.DATABASE_URL || 'postgres://graphuser:graphpassword@localhost:5432/graphdb', DATABASE_URL: process.env.DATABASE_URL || 'postgres://graphuser:graphpassword@localhost:5432/graphdb',
N8N_WHATSAPP_TRIGGER_URL: process.env.N8N_WHATSAPP_TRIGGER_URL || 'http://localhost:5678/webhook/whatsapp', N8N_WHATSAPP_TRIGGER_URL: process.env.N8N_WHATSAPP_TRIGGER_URL || 'http://localhost:5678/webhook/whatsapp',
TURNSTILE_SECRET: process.env.TURNSTILE_SECRET || process.env.TURNSTILE_SECRET_KEY || '' TURNSTILE_SECRET_KEY: process.env.TURNSTILE_SECRET_KEY || ''
}; };

View File

@@ -1,17 +1,17 @@
const express = require('express'); const express = require('express');
const { login } = require('../auth'); const { login } = require('../auth');
const { TURNSTILE_SECRET } = require('../config'); const { TURNSTILE_SECRET_KEY } = require('../config');
const router = express.Router(); const router = express.Router();
const TURNSTILE_VERIFY_URL = 'https://challenges.cloudflare.com/turnstile/v0/siteverify'; const TURNSTILE_VERIFY_URL = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
const verifyCaptcha = async (captchaToken, remoteIp) => { const verifyCaptcha = async (captchaToken, remoteIp) => {
if (!TURNSTILE_SECRET) return true; if (!TURNSTILE_SECRET_KEY) return true;
if (!captchaToken || typeof captchaToken !== 'string') return false; if (!captchaToken || typeof captchaToken !== 'string') return false;
try { try {
const formData = new URLSearchParams({ const formData = new URLSearchParams({
secret: TURNSTILE_SECRET, secret: TURNSTILE_SECRET_KEY,
response: captchaToken response: captchaToken
}); });

View File

@@ -27,7 +27,7 @@ services:
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123}
- JWT_SECRET=${JWT_SECRET:-super_secret_jwt_key_123} - JWT_SECRET=${JWT_SECRET:-super_secret_jwt_key_123}
- N8N_WHATSAPP_TRIGGER_URL=${N8N_WHATSAPP_TRIGGER_URL:-http://localhost:5678/webhook/whatsapp} - N8N_WHATSAPP_TRIGGER_URL=${N8N_WHATSAPP_TRIGGER_URL:-http://localhost:5678/webhook/whatsapp}
- TURNSTILE_SECRET=${TURNSTILE_SECRET:-${TURNSTILE_SECRET_KEY:-}} - TURNSTILE_SECRET_KEY=${TURNSTILE_SECRET_KEY:-}
depends_on: depends_on:
- db - db
restart: unless-stopped restart: unless-stopped