Fix jwt-token
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,6 +19,7 @@ logs/
|
||||
*.log
|
||||
|
||||
# Debug files
|
||||
debug_logs/
|
||||
api_debug.log
|
||||
debug.log
|
||||
requests.log
|
||||
|
||||
@@ -69,6 +69,7 @@ services:
|
||||
- "3002:3001"
|
||||
volumes:
|
||||
- ./server/logs:/app/logs
|
||||
- ./debug_logs:/app/debug_logs
|
||||
networks:
|
||||
- drone-network
|
||||
depends_on:
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user