Added LN_API_PASSWORD for BTCPayserver (#378)

Added LN_API_PASSWORD for BTCPayserver
pull/380/head
ShahanaFarooqui 4 years ago committed by GitHub
parent 3ac835cabd
commit 1443e795ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,5 +15,5 @@
<link rel="stylesheet" href="styles.7f0a84d9b012559f3600.css"></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.5e033f239370b1b56229.js" defer></script><script src="polyfills-es5.2ac0d98b22574ae745b1.js" nomodule defer></script><script src="polyfills.5ae721a6ae5ab597a53d.js" defer></script><script src="main.2a342e4f05db0d1f0594.js" defer></script></body>
<script src="runtime.5e033f239370b1b56229.js" defer></script><script src="polyfills-es5.2ac0d98b22574ae745b1.js" nomodule defer></script><script src="polyfills.5ae721a6ae5ab597a53d.js" defer></script><script src="main.6a3e5304c0ea3345640b.js" defer></script></body>
</html>

File diff suppressed because one or more lines are too long

@ -49,8 +49,7 @@ common.updateSelectedNodeOptions = () => {
break;
case 'ECL':
var eclPwd = ini.parse(fs.readFileSync(common.selectedNode.config_path, 'utf-8'))['eclair.api.password'];
common.selectedNode.options.headers = { 'authorization': 'Basic ' + Buffer.from(':' + eclPwd).toString('base64') };
common.selectedNode.options.headers = { 'authorization': 'Basic ' + Buffer.from(':' + common.selectedNode.ln_api_password).toString('base64') };
break;
default:
@ -89,8 +88,7 @@ common.setOptions = () => {
break;
case 'ECL':
var eclPwd = ini.parse(fs.readFileSync(node.config_path, 'utf-8'))['eclair.api.password'];
node.options.headers = { 'authorization': 'Basic ' + Buffer.from(':' + eclPwd).toString('base64') };
node.options.headers = { 'authorization': 'Basic ' + Buffer.from(':' + node.ln_api_password).toString('base64') };
break;
default:

@ -115,11 +115,9 @@ connect.validateNodeConfig = (config) => {
if (config.nodes && config.nodes.length > 0) {
config.nodes.forEach((node, idx) => {
common.nodes[idx] = {};
common.nodes[idx].index = node.index;
common.nodes[idx].ln_node = node.lnNode;
common.nodes[idx].ln_implementation = (process.env.LN_IMPLEMENTATION) ? process.env.LN_IMPLEMENTATION : node.lnImplementation ? node.lnImplementation : 'LND';
if (common.nodes[idx].ln_implementation !== 'ECL' && process.env.MACAROON_PATH && process.env.MACAROON_PATH.trim() !== '') {
common.nodes[idx].macaroon_path = process.env.MACAROON_PATH;
} else if(common.nodes[idx].ln_implementation !== 'ECL' && node.Authentication && node.Authentication.macaroonPath && node.Authentication.macaroonPath.trim() !== '') {
@ -128,6 +126,15 @@ connect.validateNodeConfig = (config) => {
errMsg = 'Please set macaroon path for node index ' + node.index + ' in RTL-Config.json!';
}
if (common.nodes[idx].ln_implementation === 'ECL') {
if (process.env.LN_API_PASSWORD) {
common.nodes[idx].ln_api_password = process.env.LN_API_PASSWORD;
} else if (node.Authentication && node.Authentication.lnApiPassword) {
common.nodes[idx].ln_api_password = node.Authentication.lnApiPassword;
} else {
common.nodes[idx].ln_api_password = '';
}
}
if (process.env.CONFIG_PATH) {
common.nodes[idx].config_path = process.env.CONFIG_PATH;
} else if (process.env.LND_CONFIG_PATH) {
@ -139,8 +146,24 @@ connect.validateNodeConfig = (config) => {
} else {
common.nodes[idx].config_path = '';
}
if (common.nodes[idx].ln_implementation === 'ECL' && common.nodes[idx].config_path === '') {
errMsg = errMsg + '\nPlease set config path for node index ' + node.index + ' in RTL-Config.json! Eclair authentications with `eclair.api.password` value from the file!';
if (common.nodes[idx].ln_implementation === 'ECL' && common.nodes[idx].config_path !== '') {
try {
let exists = fs.existsSync(common.nodes[idx].config_path);
if (exists) {
try {
common.nodes[idx].ln_api_password = ini.parse(fs.readFileSync(common.nodes[idx].config_path, 'utf-8'))['eclair.api.password'];
} catch (err) {
errMsg = errMsg + '\nSomething went wrong while reading config file: \n' + err;
}
} else {
errMsg = errMsg + '\nInvalid config path: ' + common.nodes[idx].config_path;
}
} catch (err) {
errMsg = errMsg + '\nUnable to read config file: \n' + err;
}
}
if (common.nodes[idx].ln_implementation === 'ECL' && common.nodes[idx].ln_api_password === '') {
errMsg = errMsg + '\nPlease set config path Or api password for node index ' + node.index + ' in RTL-Config.json! It is mandatory for Eclair authentication!';
}
if(process.env.LN_SERVER_URL && process.env.LN_SERVER_URL.trim() !== '') {

@ -22,10 +22,10 @@ exports.getFees = (req, res, next) => {
relayed: body && body.relayed ? body.relayed : []
}
};
let current_time = Math.round((new Date().getTime()) / 1000);
let month_start_time = current_time - 2629743;
let week_start_time = current_time - 604800;
let day_start_time = current_time - 86400;
let current_time = Math.round((new Date().getTime()));
let month_start_time = current_time - 2629743000;
let week_start_time = current_time - 604800000;
let day_start_time = current_time - 86400000;
let fee = 0;
resBody.payments.sent.forEach(sentEle => {
if (sentEle.recipientAmount) { sentEle.recipientAmount = Math.round(sentEle.recipientAmount/1000); }

@ -46,11 +46,12 @@ HOST (host for the rtl node server, default localhost, Optional)
LN_IMPLEMENTATION (LND/CLT/ECL. Default 'LND', Required)
LN_SERVER_URL (LN server URL for LNP REST APIs, default https://localhost:8080/v1) (Required)
SWAP_SERVER_URL (Swap server URL for REST APIs, default http://localhost:8081/v1) (Optional)
CONFIG_PATH (Full path of the LNP .conf file including the file name) (Optional for LND & CLT, Mandatory for ECL)
CONFIG_PATH (Full path of the LNP .conf file including the file name) (Optional for LND & CLT, Mandatory for ECL if LN_API_PASSWORD is undefined)
MACAROON_PATH (Path for the folder containing 'admin.macaroon' (LND)/'access.macaroon' (CLT) file, Required for LND & CLT)
RTL_SSO (1 - single sign on via an external cookie, 0 - stand alone RTL authentication, Optional)
RTL_COOKIE_PATH (Full path of the cookie file including the file name, Required if RTL_SSO=1 else Optional)
LOGOUT_REDIRECT_LINK (URL to re-direct to after logout/timeout from RTL, Required if RTL_SSO=1 else Optional)
RTL_CONFIG_PATH (Path for the folder containing 'RTL-Config.json' file, Required)
BITCOIND_CONFIG_PATH (Full path of the bitcoind.conf file including the file name, Optional)
CHANNEL_BACKUP_PATH (folder location for saving the channel backup files, valid for LND implementation only, Required if lnImplementation=LND else Optional)
CHANNEL_BACKUP_PATH (Folder location for saving the channel backup files, valid for LND implementation only, Required if ln implementation=LND else Optional)
LN_API_PASSWORD (Password for Eclair implementation if the eclair.conf path is not available, Required if ln implementation=LND && config path is undefined)

8
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.8.1-beta",
"version": "0.8.2-beta",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -4519,6 +4519,12 @@
"is-obj": "^2.0.0"
}
},
"dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
"dev": true
},
"duplexer3": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",

@ -1,6 +1,6 @@
{
"name": "rtl",
"version": "0.8.1-beta",
"version": "0.8.2-beta",
"license": "MIT",
"scripts": {
"ng": "ng",
@ -59,10 +59,11 @@
"@angular-devkit/build-angular": "~0.901.7",
"@angular/cli": "~9.1.7",
"@ngrx/store-devtools": "^9.2.0",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"dotenv": "^8.2.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",

@ -1 +1 @@
export const VERSION = '0.8.1-beta';
export const VERSION = '0.8.2-beta';
Loading…
Cancel
Save