From 21479034ae083599f8433feae977394fd23635ec Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Tue, 19 Aug 2025 20:31:43 +0200 Subject: [PATCH] Fix jwt-token --- .gitignore | 1 + docker-compose.yml | 1 + server/utils/apiDebugLogger.js | 15 +++++++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 67ff557..ce91af1 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ logs/ *.log # Debug files +debug_logs/ api_debug.log debug.log requests.log diff --git a/docker-compose.yml b/docker-compose.yml index 397ec36..fd14f69 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -69,6 +69,7 @@ services: - "3002:3001" volumes: - ./server/logs:/app/logs + - ./debug_logs:/app/debug_logs networks: - drone-network depends_on: diff --git a/server/utils/apiDebugLogger.js b/server/utils/apiDebugLogger.js index 454be70..fc5b2f1 100644 --- a/server/utils/apiDebugLogger.js +++ b/server/utils/apiDebugLogger.js @@ -3,8 +3,8 @@ const path = require('path'); class ApiDebugLogger { constructor() { - // Use /tmp directory which has universal write permissions in containers - this.logFile = '/tmp/api_debug.log'; + // Use mounted volume directory that's accessible from host + this.logFile = '/app/debug_logs/api_debug.log'; this.enabled = process.env.NODE_ENV === 'development' || process.env.API_DEBUG === 'true'; this.fileLoggingEnabled = false; @@ -13,11 +13,18 @@ class ApiDebugLogger { console.log(`🐛 ApiDebugLogger: Enabled (NODE_ENV=${process.env.NODE_ENV}, API_DEBUG=${process.env.API_DEBUG})`); console.log(`🐛 ApiDebugLogger: Log file path: ${this.logFile}`); - // Try to enable file logging + // Ensure the debug_logs directory exists try { + const fs = require('fs'); + const debugDir = '/app/debug_logs'; + if (!fs.existsSync(debugDir)) { + fs.mkdirSync(debugDir, { recursive: true }); + console.log(`🐛 ApiDebugLogger: Created debug logs directory at ${debugDir}`); + } + fs.writeFileSync(this.logFile, `# API Debug Log Started at ${new Date().toISOString()}\n`); this.fileLoggingEnabled = true; - console.log(`🐛 ApiDebugLogger: File logging enabled at ${this.logFile}`); + console.log(`🐛 ApiDebugLogger: File logging enabled at ${this.logFile} (mounted to host: ./debug_logs/)`); } catch (error) { console.warn(`⚠️ ApiDebugLogger: File logging disabled - using console only. Error: ${error.message}`); this.fileLoggingEnabled = false;