mirror of
https://github.com/ringtools/ringtools-server-ts.git
synced 2024-05-16 05:44:40 +02:00
No more reject unauthorized
This commit is contained in:
parent
a24029918e
commit
f41af2a769
@ -1,4 +1,6 @@
|
||||
PORT=7464
|
||||
ALLOWED_HOSTS=['*']
|
||||
MACAROON=ABC
|
||||
LND_REST_API=localhost:8080
|
||||
LND_REST_API=localhost:8080
|
||||
REJECT_UNAUTHORIZED=false
|
||||
TLS_CERT_BASE64=ABCD=
|
@ -8,8 +8,14 @@ import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const decodedTlsCert = Buffer.from(
|
||||
process.env.TLS_CERT_BASE64 || '',
|
||||
'base64',
|
||||
).toString('ascii');
|
||||
|
||||
const httpsAgent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
rejectUnauthorized: Boolean(process.env.REJECT_UNAUTHORIZED) || true,
|
||||
ca: decodedTlsCert,
|
||||
});
|
||||
|
||||
axios.defaults.httpsAgent = httpsAgent;
|
||||
@ -46,8 +52,8 @@ export class LndService {
|
||||
this.ws = new WebSocket(
|
||||
`wss://${this.lndRestApiUrl}/v1/graph/subscribe?method=GET`,
|
||||
{
|
||||
// Work-around for self-signed certificates.
|
||||
rejectUnauthorized: false,
|
||||
rejectUnauthorized: Boolean(process.env.REJECT_UNAUTHORIZED) || true,
|
||||
ca: decodedTlsCert,
|
||||
headers: {
|
||||
'Grpc-Metadata-Macaroon': this.macaroon,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user