@@ -7,23 +7,25 @@ module.exports = {
77 genContractDeployEnv,
88} ;
99
10- function genSubnetConfig ( subnet_id , key ) {
10+ function genSubnetConfig ( subnet_id , key , ip_record ) {
1111 const key_name = `key${ subnet_id } ` ;
1212 let private_key = key [ key_name ] [ "PrivateKey" ] ;
1313 private_key = private_key . slice ( 2 , private_key . length ) ; // remove 0x for subnet conf
1414 const port = 20303 + subnet_id - 1 ;
1515 const rpcport = 8545 + subnet_id - 1 ;
1616 const wsport = 9555 + subnet_id - 1 ;
17+ const bootnode_ip = config . num_machines === 1 ? ip_record [ "bootnode" ] : config . ip_1 ;
18+ const stats_ip = config . num_machines === 1 ? ip_record [ "stats" ] : config . ip_1
1719 const config_env = `
1820INSTANCE_NAME=subnet${ subnet_id }
1921PRIVATE_KEY=${ private_key }
2022BOOTNODES=enode://cc566d1033f21c7eb0eb9f403bb651f3949b5f63b40683917\
2123765c343f9c0c596e9cd021e2e8416908cbc3ab7d6f6671a83c85f7b121c1872f8be\
22- 50a591723a5d@${ config . ip_1 } :20301
24+ 50a591723a5d@${ bootnode_ip } :20301
2325NETWORK_ID=${ config . network_id }
2426SYNC_MODE=full
2527RPC_API=db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS
26- STATS_SERVICE_ADDRESS=${ config . ip_1 } :5213
28+ STATS_SERVICE_ADDRESS=${ stats_ip } :5213
2729STATS_SECRET=${ config . secret_string }
2830PORT=${ port }
2931RPCPORT=${ rpcport }
@@ -37,15 +39,17 @@ LOG_LEVEL=2
3739
3840function genServicesConfig ( ) {
3941 const url = config . parentnet . url ;
42+ const bootnode_ip = config . num_machines === 1 ? ip_record [ "bootnode" ] : config . ip_1 ;
43+ const subnet_ip = config . num_machines === 1 ? ip_record [ "subnet1" ] : config . ip_1 ;
4044 let config_env = `
4145# Bootnode
42- EXTIP=${ config . ip_1 }
46+ EXTIP=${ bootnode_ip }
4347BOOTNODE_PORT=20301
4448
4549# Stats and relayer
4650PARENTNET_URL=${ url }
4751PARENTNET_WALLET=${ config . parentnet . pubkey }
48- SUBNET_URL=http://${ config . ip_1 } :8545
52+ SUBNET_URL=http://${ subnet_ip } :8545
4953RELAYER_MODE=${ config . relayer_mode }
5054SLACK_WEBHOOK=https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
5155CORS_ALLOW_ORIGIN=*
@@ -91,10 +95,11 @@ if (config.zero.zero_mode == 'one-directional'){
9195}
9296
9397
94- function genContractDeployEnv ( ) {
98+ function genContractDeployEnv ( ip_record ) {
99+ const subnet_ip = config . num_machines === 1 ? ip_record [ "subnet1" ] : config . ip_1
95100 const config_deploy = `
96101PARENTNET_URL=${ config . parentnet . url }
97- SUBNET_URL=http://${ config . ip_1 } :8545
102+ SUBNET_URL=http://${ subnet_ip } :8545
98103
99104
100105PARENTNET_PK=${ config . parentnet . privatekey }
0 commit comments