mirror of
https://github.com/aljazceru/cyphernode.git
synced 2026-02-05 04:24:22 +01:00
added simple config file template support
This commit is contained in:
@@ -36,5 +36,8 @@ module.exports = {
|
||||
},
|
||||
env: function( props ) {
|
||||
return 'VAR0=VALUE0\nVAR1=VALUE1'
|
||||
},
|
||||
templates: function( props ) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
@@ -67,5 +67,8 @@ module.exports = {
|
||||
},
|
||||
env: function( props ) {
|
||||
return 'VAR0=VALUE0\nVAR1=VALUE1'
|
||||
},
|
||||
templates: function( props ) {
|
||||
return ['bitcoin.conf']
|
||||
}
|
||||
};
|
||||
@@ -1,8 +1,15 @@
|
||||
const path = require('path');
|
||||
|
||||
const name = 'lightning';
|
||||
const featureCondition = function(props) {
|
||||
return props.features && props.features.indexOf( name ) != -1;
|
||||
}
|
||||
|
||||
const templates = {
|
||||
'lnd': [ path.join('lnd','lnd.conf') ],
|
||||
'c-lightning': [ path.join('c-lightning','config') ]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: function() {
|
||||
return name;
|
||||
@@ -36,5 +43,8 @@ module.exports = {
|
||||
},
|
||||
env: function( props ) {
|
||||
return 'VAR0=VALUE0\nVAR1=VALUE1'
|
||||
},
|
||||
templates: function( props ) {
|
||||
return templates[props.lightning_implementation]
|
||||
}
|
||||
};
|
||||
@@ -28,5 +28,8 @@ module.exports = {
|
||||
},
|
||||
env: function( props ) {
|
||||
return 'VAR0=VALUE0\nVAR1=VALUE1'
|
||||
},
|
||||
templates: function( props ) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
@@ -13,5 +13,8 @@ module.exports = {
|
||||
},
|
||||
env: function( props ) {
|
||||
return 'VAR0=VALUE0\nVAR1=VALUE1';
|
||||
},
|
||||
templates: function( props ) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
@@ -19,8 +19,8 @@ module.exports = class extends Generator {
|
||||
constructor(args, opts) {
|
||||
super(args, opts);
|
||||
|
||||
if( fs.existsSync('/data/props.json') ) {
|
||||
this.props = require('/data/props.json');
|
||||
if( fs.existsSync(this.destinationPath('props.json')) ) {
|
||||
this.props = require(this.destinationPath('props.json'));
|
||||
} else {
|
||||
this.props = {};
|
||||
}
|
||||
@@ -48,17 +48,22 @@ module.exports = class extends Generator {
|
||||
}
|
||||
|
||||
writing() {
|
||||
fs.writeFileSync('/data/props.json', JSON.stringify(this.props, null, 2));
|
||||
fs.writeFileSync(this.destinationPath('props.json'), JSON.stringify(this.props, null, 2));
|
||||
|
||||
for( let m of featurePromptModules ) {
|
||||
fs.writeFileSync('/data/'+m.name(), m.env());
|
||||
const name = m.name();
|
||||
fs.writeFileSync(this.destinationPath(name+'.properties'), m.env());
|
||||
|
||||
for( let t of m.templates(this.props) ) {
|
||||
const p = path.join(name,t);
|
||||
this.fs.copyTpl(
|
||||
this.templatePath(p),
|
||||
this.destinationPath(p),
|
||||
this.props
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
this.fs.copy(
|
||||
this.templatePath('dummyfile.txt'),
|
||||
this.destinationPath('dummyfile.txt')
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
install() {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<% if (cyphernode_net === 'testnet') { %>
|
||||
# testnet
|
||||
testnet=1
|
||||
<% } %>
|
||||
|
||||
<% if (lightning_implementation === 'lnd') { %>
|
||||
#lnd opts
|
||||
txindex=1
|
||||
zmqpubrawblock=tcp://0.0.0.0:18501
|
||||
zmqpubrawtx=tcp://0.0.0.0:18502
|
||||
<% } %>
|
||||
|
||||
#tor
|
||||
#proxy=127.0.0.1:9050
|
||||
#listen=1
|
||||
|
||||
rpcconnect=btcnode
|
||||
rpcuser=<%= bitcoin_rpcuser %>
|
||||
rpcpassword=<%= bitcoin_rpcpassword %>
|
||||
rpcwallet=ln01.dat
|
||||
@@ -0,0 +1,4 @@
|
||||
alias=SatoshiPortal01
|
||||
rgb=008000
|
||||
#port=9735
|
||||
network=testnet
|
||||
@@ -0,0 +1,27 @@
|
||||
[Application Options]
|
||||
debuglevel=info
|
||||
maxpendingchannels=10
|
||||
externalip=88.198.55.131
|
||||
color=#a111ff
|
||||
alias=SatoshiPortal01
|
||||
rpclisten=0.0.0.0:10009
|
||||
tlsextraip=lnd
|
||||
tlsextradomain=lnd
|
||||
|
||||
[Bitcoin]
|
||||
bitcoin.active=1
|
||||
bitcoin.node=bitcoind
|
||||
bitcoin.mainnet=1
|
||||
|
||||
[Bitcoind]
|
||||
bitcoind.rpcuser=<%= bitcoin_rpcuser %>
|
||||
bitcoind.rpcpass=<%= bitcoin_rpcpassword %>
|
||||
bitcoind.zmqpubrawblock=tcp://bitcoin:18501
|
||||
bitcoind.zmqpubrawtx=tcp://bitcoin:18502
|
||||
#bitcoind.zmqpath=tcp://bitcoin:18501
|
||||
bitcoind.rpchost=bitcoin
|
||||
|
||||
[autopilot]
|
||||
autopilot.active=1
|
||||
autopilot.maxchannels=5
|
||||
autopilot.allocation=0.6
|
||||
Reference in New Issue
Block a user