OPS: macaroon & tls.cert in env
This commit is contained in:
parent
cb44f2cc33
commit
f05bdb3365
32
config.js
32
config.js
@ -1,22 +1,22 @@
|
||||
let config = {
|
||||
bitcoind: {
|
||||
rpc: 'http://login:password@1.1.1.1:8332',
|
||||
},
|
||||
redis: {
|
||||
port: 12914,
|
||||
host: '1.1.1.1',
|
||||
family: 4,
|
||||
password: 'password',
|
||||
db: 0,
|
||||
},
|
||||
lnd: {
|
||||
url: '1.1.1.1:10009',
|
||||
},
|
||||
bitcoind: {
|
||||
rpc: 'http://login:password@1.1.1.1:8332',
|
||||
},
|
||||
redis: {
|
||||
port: 12914,
|
||||
host: '1.1.1.1',
|
||||
family: 4,
|
||||
password: 'password',
|
||||
db: 0,
|
||||
},
|
||||
lnd: {
|
||||
url: '1.1.1.1:10009',
|
||||
},
|
||||
};
|
||||
|
||||
if (process.env.CONFIG) {
|
||||
console.log('using config from env');
|
||||
config = JSON.parse(process.env.CONFIG)
|
||||
console.log('using config from env');
|
||||
config = JSON.parse(process.env.CONFIG);
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
module.exports = config;
|
||||
|
@ -26,16 +26,28 @@ var fs = require('fs');
|
||||
var grpc = require('grpc');
|
||||
var lnrpc = grpc.load('rpc.proto').lnrpc;
|
||||
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
|
||||
var lndCert = fs.readFileSync('tls.cert');
|
||||
var sslCreds = grpc.credentials.createSsl(lndCert);
|
||||
var macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
|
||||
var macaroon = fs.readFileSync('admin.macaroon').toString('hex');
|
||||
var metadata = new grpc.Metadata();
|
||||
var lndCert;
|
||||
if (process.env.TLSCERT) {
|
||||
lndCert = Buffer.from(process.env.TLSCERT, 'hex');
|
||||
} else {
|
||||
lndCert = fs.readFileSync('tls.cert');
|
||||
}
|
||||
console.log('using tls.cert', lndCert.toString('hex'));
|
||||
let sslCreds = grpc.credentials.createSsl(lndCert);
|
||||
let macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
|
||||
let macaroon;
|
||||
if (process.env.MACAROON) {
|
||||
macaroon = process.env.MACAROON;
|
||||
} else {
|
||||
macaroon = fs.readFileSync('admin.macaroon').toString('hex');
|
||||
}
|
||||
console.log('using macaroon', macaroon);
|
||||
let metadata = new grpc.Metadata();
|
||||
metadata.add('macaroon', macaroon);
|
||||
callback(null, metadata);
|
||||
});
|
||||
var creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
|
||||
var lightning = new lnrpc.Lightning(config.lnd.url, creds);
|
||||
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
|
||||
let lightning = new lnrpc.Lightning(config.lnd.url, creds);
|
||||
|
||||
// ###################### SMOKE TESTS ########################
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user