Turn off LN if Macaroon is missing
This commit is contained in:
parent
758e4d4f4c
commit
d337bf3ee2
@ -10,22 +10,22 @@ class LndApi implements AbstractLightningApi {
|
|||||||
axiosConfig: AxiosRequestConfig = {};
|
axiosConfig: AxiosRequestConfig = {};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (config.LIGHTNING.ENABLED) {
|
if (!config.LIGHTNING.ENABLED) {
|
||||||
try {
|
return;
|
||||||
const macaroon = fs.readFileSync(config.LND.MACAROON_PATH).toString('hex');
|
}
|
||||||
this.axiosConfig = {
|
try {
|
||||||
headers: {
|
this.axiosConfig = {
|
||||||
'Grpc-Metadata-macaroon': macaroon
|
headers: {
|
||||||
},
|
'Grpc-Metadata-macaroon': fs.readFileSync(config.LND.MACAROON_PATH).toString('hex'),
|
||||||
httpsAgent: new Agent({
|
},
|
||||||
ca: fs.readFileSync(config.LND.TLS_CERT_PATH)
|
httpsAgent: new Agent({
|
||||||
}),
|
ca: fs.readFileSync(config.LND.TLS_CERT_PATH)
|
||||||
timeout: config.LND.TIMEOUT
|
}),
|
||||||
};
|
timeout: config.LND.TIMEOUT
|
||||||
} catch (e) {
|
};
|
||||||
logger.err(`Could not initialize LND Macaroon/TLS Cert. Disabling LIGHTNING. ` + (e instanceof Error ? e.message : e));
|
} catch (e) {
|
||||||
config.LIGHTNING.ENABLED = false;
|
logger.err(`Could not initialize LND Macaroon/TLS Cert. Disabling LIGHTNING. ` + (e instanceof Error ? e.message : e));
|
||||||
}
|
config.LIGHTNING.ENABLED = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user