vite_deleteelectron
This commit is contained in:
@@ -4,9 +4,14 @@
|
||||
|
||||
const mysql = require('mysql2/promise'); // ✅ Используем promise-версию
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const fs = require('fs').promises;
|
||||
const { logger } = require('./logger');
|
||||
|
||||
async function readJson(filePath) {
|
||||
const data = await fs.readFile(filePath, 'utf8');
|
||||
return JSON.parse(data);
|
||||
}
|
||||
|
||||
// Загружаем переменные окружения
|
||||
require('dotenv').config({ path: path.join(__dirname, '../../config.env') });
|
||||
|
||||
@@ -42,7 +47,7 @@ let isReconnecting = false;
|
||||
async function checkTestMode() {
|
||||
try {
|
||||
const configPath = path.join(__dirname, '../../config.json');
|
||||
const config = await fs.readJson(configPath);
|
||||
const config = await readJson(configPath);
|
||||
return config.testMode === true;
|
||||
} catch (err) {
|
||||
logger.warn('⚠️ Не удалось прочитать config.json для проверки testMode', { error: err.message });
|
||||
|
||||
Reference in New Issue
Block a user