abler-api 0.1.33 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/pp-util.js +12 -8
- package/dist/es/pp-util.js +12 -8
- package/package.json +1 -1
package/dist/cjs/pp-util.js
CHANGED
|
@@ -1077,9 +1077,14 @@ class apiUtil$2 {
|
|
|
1077
1077
|
|
|
1078
1078
|
static async hostIsMySelf(host, req) {
|
|
1079
1079
|
let clientIp = apiUtil$2.getClientIp(req);
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1080
|
+
|
|
1081
|
+
try {
|
|
1082
|
+
return !!ppUtil$4.getMyIp({
|
|
1083
|
+
hosts: [host, clientIp]
|
|
1084
|
+
});
|
|
1085
|
+
} catch (e) {
|
|
1086
|
+
return false;
|
|
1087
|
+
}
|
|
1083
1088
|
}
|
|
1084
1089
|
/**
|
|
1085
1090
|
* 检查是否应该把请求转发到其它服务器,若是则转发
|
|
@@ -1462,7 +1467,7 @@ var ppUtilApi = apiUtil$2;
|
|
|
1462
1467
|
const fs = require$$4__default["default"];
|
|
1463
1468
|
const path = require$$1__default$1["default"];
|
|
1464
1469
|
const ppUtil$3 = require$$1__default["default"].ppUtil;
|
|
1465
|
-
const
|
|
1470
|
+
const ppRedis = require$$2__default["default"].ppRedis;
|
|
1466
1471
|
let conf$2, err$1; // const dbCheck = require('../dbupdate/dd-version');
|
|
1467
1472
|
|
|
1468
1473
|
/**
|
|
@@ -1600,9 +1605,8 @@ async function checkExEnvSetting(loadjs) {
|
|
|
1600
1605
|
let msg = await createEnvSettingFile(fileName, envSettingEx);
|
|
1601
1606
|
|
|
1602
1607
|
if (!msg) {
|
|
1603
|
-
delete require.cache[
|
|
1604
|
-
|
|
1605
|
-
pputil.importExEnvSetting(conf$2._envSetting, envSettingEx);
|
|
1608
|
+
delete require.cache[fileName];
|
|
1609
|
+
ppUtil$3.importExEnvSetting(conf$2._envSetting, fileName, loadjs);
|
|
1606
1610
|
}
|
|
1607
1611
|
|
|
1608
1612
|
return msg;
|
|
@@ -1615,7 +1619,7 @@ async function checkExEnvSetting(loadjs) {
|
|
|
1615
1619
|
|
|
1616
1620
|
async function checkRedis() {
|
|
1617
1621
|
if (!conf$2.redis.enabled) return "";
|
|
1618
|
-
const redis =
|
|
1622
|
+
const redis = ppRedis.newClient("kv"); // console.log(`checkRedis begin:`);
|
|
1619
1623
|
|
|
1620
1624
|
await ppUtil$3.wait(15 * 1000, param => {
|
|
1621
1625
|
if (redis.ready && redis.connected || redis.error) {
|
package/dist/es/pp-util.js
CHANGED
|
@@ -1064,9 +1064,14 @@ class apiUtil$2 {
|
|
|
1064
1064
|
|
|
1065
1065
|
static async hostIsMySelf(host, req) {
|
|
1066
1066
|
let clientIp = apiUtil$2.getClientIp(req);
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1067
|
+
|
|
1068
|
+
try {
|
|
1069
|
+
return !!ppUtil$4.getMyIp({
|
|
1070
|
+
hosts: [host, clientIp]
|
|
1071
|
+
});
|
|
1072
|
+
} catch (e) {
|
|
1073
|
+
return false;
|
|
1074
|
+
}
|
|
1070
1075
|
}
|
|
1071
1076
|
/**
|
|
1072
1077
|
* 检查是否应该把请求转发到其它服务器,若是则转发
|
|
@@ -1449,7 +1454,7 @@ var ppUtilApi = apiUtil$2;
|
|
|
1449
1454
|
const fs = require$$4;
|
|
1450
1455
|
const path = require$$1$1;
|
|
1451
1456
|
const ppUtil$3 = require$$1.ppUtil;
|
|
1452
|
-
const
|
|
1457
|
+
const ppRedis = require$$2.ppRedis;
|
|
1453
1458
|
let conf$2, err$1; // const dbCheck = require('../dbupdate/dd-version');
|
|
1454
1459
|
|
|
1455
1460
|
/**
|
|
@@ -1587,9 +1592,8 @@ async function checkExEnvSetting(loadjs) {
|
|
|
1587
1592
|
let msg = await createEnvSettingFile(fileName, envSettingEx);
|
|
1588
1593
|
|
|
1589
1594
|
if (!msg) {
|
|
1590
|
-
delete require.cache[
|
|
1591
|
-
|
|
1592
|
-
pputil.importExEnvSetting(conf$2._envSetting, envSettingEx);
|
|
1595
|
+
delete require.cache[fileName];
|
|
1596
|
+
ppUtil$3.importExEnvSetting(conf$2._envSetting, fileName, loadjs);
|
|
1593
1597
|
}
|
|
1594
1598
|
|
|
1595
1599
|
return msg;
|
|
@@ -1602,7 +1606,7 @@ async function checkExEnvSetting(loadjs) {
|
|
|
1602
1606
|
|
|
1603
1607
|
async function checkRedis() {
|
|
1604
1608
|
if (!conf$2.redis.enabled) return "";
|
|
1605
|
-
const redis =
|
|
1609
|
+
const redis = ppRedis.newClient("kv"); // console.log(`checkRedis begin:`);
|
|
1606
1610
|
|
|
1607
1611
|
await ppUtil$3.wait(15 * 1000, param => {
|
|
1608
1612
|
if (redis.ready && redis.connected || redis.error) {
|