From 346fa0e6c0b88f86eccfca8ac99bb4952ef0d86f Mon Sep 17 00:00:00 2001 From: saubyk Date: Fri, 29 Mar 2019 18:22:50 -0400 Subject: [PATCH] Mutli Node Read API Mutli Node Read API --- RTL-Multi-Node-Conf.json | 56 ++++++++++++++++++++++++++++++++++++++++ controllers/RTLConf.js | 20 ++++++++++++++ routes/RTLConf.js | 1 + 3 files changed, 77 insertions(+) create mode 100644 RTL-Multi-Node-Conf.json diff --git a/RTL-Multi-Node-Conf.json b/RTL-Multi-Node-Conf.json new file mode 100644 index 00000000..c4d6ce09 --- /dev/null +++ b/RTL-Multi-Node-Conf.json @@ -0,0 +1,56 @@ +[ +{ + "LNNode": "LND Testnet # 1", + "LNImplementation": "LND", + "Authentication": { + "macaroonPath": "/Users/suheb/Downloads", + "nodeAuthType": "CUSTOM", + "lndConfigPath": "", + "rtlPass": "xxx" + }, + "Settings": { + "flgSidenavOpened": "true", + "flgSidenavPinned": "true", + "menu": "Vertical", + "menuType": "Regular", + "theme": "dark-blue", + "satsToBTC": "false", + "bitcoindConfigPath": "", + "enableLogging": "true", + "port": "3000", + "lndServerUrl": "https://localhost:8080/v1" + }, + "SSO":{ + "rtlSSO": 0, + "rtlCookiePath": "", + "logoutRedirectLink": "" + } +}, +{ + "LNNode": "LND Mainnet # 1", + "LNImplementation": "LND", + "Authentication": { + "macaroonPath": "/Users/suheb/Downloads", + "nodeAuthType": "CUSTOM", + "lndConfigPath": "", + "rtlPass": "xxx" + }, + "Settings": { + "flgSidenavOpened": "true", + "flgSidenavPinned": "true", + "menu": "Vertical", + "menuType": "Regular", + "theme": "dark-blue", + "satsToBTC": "false", + "bitcoindConfigPath": "", + "enableLogging": "true", + "port": "3000", + "lndServerUrl": "https://localhost:8080/v1" + }, + "SSO":{ + "rtlSSO": 0, + "rtlCookiePath": "", + "logoutRedirectLink": "" + } +} +] \ No newline at end of file diff --git a/controllers/RTLConf.js b/controllers/RTLConf.js index 844d7340..a6fe5aec 100644 --- a/controllers/RTLConf.js +++ b/controllers/RTLConf.js @@ -83,3 +83,23 @@ exports.getConfig = (req, res, next) => { } }); }; + +exports.getMultiNodeConfig = (req, res, next) => { + var RTLMultiNodeConfFile = common.rtl_conf_file_path + '/RTL-Multi-Node-Conf.json'; + logger.info('\r\nRTLConf.js: 91: ' + JSON.stringify(Date.now()) + ': INFO: Getting Multi Node Config'); + fs.readFile(RTLMultiNodeConfFile, 'utf8', function(err, data) { + if (err) { + logger.error('\r\nRTLConf.js: 94: ' + JSON.stringify(Date.now()) + ': ERROR: Getting Multi Node Config Failed!'); + res.status(500).json({ + message: "Reading Multi Node Config Failed!", + error: err + }); + } else { + const multiNodeConfig = require('../RTL-Multi-Node-Conf.json'); + var nodeinfo = []; + for(var key in multiNodeConfig) + nodeinfo.push({"LNNode":multiNodeConfig[key].LNNode, "LNImpl":multiNodeConfig[key].LNImplementation}); + res.status(200).json({nodes:nodeinfo}); + } + }); +}; \ No newline at end of file diff --git a/routes/RTLConf.js b/routes/RTLConf.js index c12af194..2d734398 100644 --- a/routes/RTLConf.js +++ b/routes/RTLConf.js @@ -6,5 +6,6 @@ const authCheck = require("./authCheck"); router.get("/rtlconf", RTLConfController.getRTLConfig); router.post("/", authCheck, RTLConfController.updateUISettings); router.get("/config/:nodeType", authCheck, RTLConfController.getConfig); +router.get("/multinode", RTLConfController.getMultiNodeConfig); module.exports = router;