v2.1
This commit is contained in:
@@ -1,4 +1,23 @@
|
||||
const express = require('express');
|
||||
const checkForServerConnection = async () => {
|
||||
const pathToIpConfig = path.join(__dirname, '..', '..', 'ipConfig.json');
|
||||
await lockFile.lock(pathToIpConfig);
|
||||
try {
|
||||
await decryptFileInPlace(pathToIpConfig);
|
||||
const ipConfig = await fs.readFile(pathToIpConfig, 'utf-8');
|
||||
const { ip } = JSON.parse(ipConfig);
|
||||
const response = await fetch(`http://${ip}:5000/heartbeat`);
|
||||
if (response.ok) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
return false;
|
||||
} finally {
|
||||
await lockFile.unlock(pathToIpConfig);
|
||||
}
|
||||
};const express = require('express');
|
||||
const crypto = require('crypto');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user