commit
b82e124bbe
2 changed files with 10 additions and 3 deletions
|
|
@ -50,7 +50,7 @@
|
||||||
"request-promise": "^4.2.2",
|
"request-promise": "^4.2.2",
|
||||||
"response-time": "^2.3.2",
|
"response-time": "^2.3.2",
|
||||||
"shelljs": "^0.8.2",
|
"shelljs": "^0.8.2",
|
||||||
"socket.io": "^2.3.0",
|
"socket.io": "^2.1.1",
|
||||||
"text-encoding": "^0.7.0",
|
"text-encoding": "^0.7.0",
|
||||||
"tingodb": "^0.6.1",
|
"tingodb": "^0.6.1",
|
||||||
"winston": "^2.3.1",
|
"winston": "^2.3.1",
|
||||||
|
|
|
||||||
|
|
@ -89,26 +89,31 @@ module.exports = async (
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkHealth = async () => {
|
const checkHealth = async () => {
|
||||||
|
logger.info("Getting service status...")
|
||||||
const serviceStatus = await getAvailableService();
|
const serviceStatus = await getAvailableService();
|
||||||
|
logger.info("Received status:", serviceStatus);
|
||||||
const LNDStatus = serviceStatus;
|
const LNDStatus = serviceStatus;
|
||||||
try {
|
try {
|
||||||
|
logger.info("Getting API status...");
|
||||||
const APIHealth = await Http.get(`${usetls ? 'https' : 'http'}://localhost:${serverPort}/ping`);
|
const APIHealth = await Http.get(`${usetls ? 'https' : 'http'}://localhost:${serverPort}/ping`);
|
||||||
const APIStatus = {
|
const APIStatus = {
|
||||||
message: APIHealth.data,
|
message: APIHealth.data,
|
||||||
responseTime: APIHealth.headers["x-response-time"],
|
responseTime: APIHealth.headers["x-response-time"],
|
||||||
success: true
|
success: true
|
||||||
};
|
};
|
||||||
|
logger.info("Received API status!", APIStatus);
|
||||||
return {
|
return {
|
||||||
LNDStatus,
|
LNDStatus,
|
||||||
APIStatus
|
APIStatus
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
logger.error(err);
|
||||||
const APIStatus = {
|
const APIStatus = {
|
||||||
message: err.response.data,
|
message: err.response.data,
|
||||||
responseTime: err.response.headers["x-response-time"],
|
responseTime: err.response.headers["x-response-time"],
|
||||||
success: false
|
success: false
|
||||||
};
|
};
|
||||||
|
logger.warn("Failed to retrieve API status", APIStatus);
|
||||||
return {
|
return {
|
||||||
LNDStatus,
|
LNDStatus,
|
||||||
APIStatus
|
APIStatus
|
||||||
|
|
@ -307,10 +312,12 @@ module.exports = async (
|
||||||
*/
|
*/
|
||||||
app.get("/healthz", async (req, res) => {
|
app.get("/healthz", async (req, res) => {
|
||||||
const health = await checkHealth();
|
const health = await checkHealth();
|
||||||
|
logger.info("Healthz response:", health);
|
||||||
res.json(health);
|
res.json(health);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/ping", (req, res) => {
|
app.get("/ping", (req, res) => {
|
||||||
|
logger.info("Ping completed!");
|
||||||
res.json({ message: "OK" });
|
res.json({ message: "OK" });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1205,7 +1212,7 @@ module.exports = async (
|
||||||
funding_txid_str: channelPoint,
|
funding_txid_str: channelPoint,
|
||||||
output_index: outputIndex
|
output_index: outputIndex
|
||||||
},
|
},
|
||||||
force: force
|
force
|
||||||
};
|
};
|
||||||
logger.info("CloseChannelRequest", closeChannelRequest);
|
logger.info("CloseChannelRequest", closeChannelRequest);
|
||||||
const closedChannel = lightning.closeChannel(closeChannelRequest);
|
const closedChannel = lightning.closeChannel(closeChannelRequest);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue