Update
This commit is contained in:
1 parent
699354b85a
commit
8322427457
8 files changed
+143
-9
No files matched your search
@@ -0,0 +1,19 @@
|
||||
const { exec } = require('node:child_process');
|
||||
const ecosystem = require('../ecosystem.config.js');
|
||||
|
||||
const executeCommand = cmd =>
|
||||
new Promise((resolve, reject) => {
|
||||
exec(cmd, (err, stdout, stderr) => {
|
||||
if (err || stderr) reject(err || stderr);
|
||||
else resolve(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = async () => {
|
||||
try {
|
||||
console.log(await executeCommand('npm install --omit=dev'));
|
||||
console.log(await executeCommand(`pm2 restart ${ecosystem.apps[0].name}`));
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
const os = require('node:os');
|
||||
const axios = require('./axios.js');
|
||||
const isLocalIP = require('../utils/isLocalIP.js');
|
||||
const { MAIN } = require('../config.js');
|
||||
const { REFRESHING_IP_ADDRESS } = require('../config.js').MAIN;
|
||||
|
||||
const ipAddressList = new Set();
|
||||
|
||||
@@ -20,9 +20,7 @@ const fetchIPv6Address = () => {
|
||||
Object.values(networkInterfaces).forEach(interfaces => {
|
||||
interfaces.forEach(details => {
|
||||
const ip = details.address;
|
||||
if (!details.internal && ip && !isLocalIP(ip)) {
|
||||
ipAddressList.add(ip);
|
||||
}
|
||||
if (!details.internal && ip && !isLocalIP(ip)) ipAddressList.add(ip);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -35,7 +33,7 @@ const fetchIPAddress = async () => {
|
||||
|
||||
(async () => {
|
||||
await fetchIPAddress();
|
||||
setInterval(fetchIPAddress, MAIN.REFRESHING_IP_ADDRESS);
|
||||
setInterval(fetchIPAddress, REFRESHING_IP_ADDRESS);
|
||||
|
||||
// console.debug(ipAddressList);
|
||||
})();
|
||||
|
||||
Reference in new issue
Block a user