Message board - host registration (#97)

This commit is contained in:
Kithmini Gunawardhana
2022-03-11 09:53:18 +05:30
committed by GitHub
parent e696207e46
commit d8a66f8933
2 changed files with 5 additions and 4 deletions

View File

@@ -21,9 +21,9 @@ async function main() {
const acc = await setup.generateBetaHostAccount(registryAddress);
setup.newConfig(acc.address, acc.secret, registryAddress, acc.token);
}
else if (process.argv.length === 9 && process.argv[2] === 'register') {
else if (process.argv.length === 10 && process.argv[2] === 'register') {
await new Setup().register(process.argv[3], parseInt(process.argv[4]), parseInt(process.argv[5]),
parseInt(process.argv[6]), parseInt(process.argv[7]), process.argv[8]);
parseInt(process.argv[6]), parseInt(process.argv[7]), parseInt(process.argv[8]), process.argv[9]);
}
else if (process.argv.length === 3 && process.argv[2] === 'deregister') {
await new Setup().deregister();

View File

@@ -2,6 +2,7 @@
const https = require('https');
const { appenv } = require('./appenv');
const evernode = require('evernode-js-client');
const fs = require('fs');
class Setup {
@@ -124,7 +125,7 @@ class Setup {
return acc;
}
async register(countryCode, cpuMicroSec, ramKb, swapKb, diskKb, description) {
async register(countryCode, cpuMicroSec, ramKb, swapKb, diskKb, totalInstanceCount, description) {
console.log("Registering host...");
const acc = this.#getConfig().xrpl;
evernode.Defaults.set({
@@ -140,7 +141,7 @@ class Setup {
while (attempts >= 0) {
try {
await hostClient.register(acc.token, countryCode, cpuMicroSec,
Math.floor((ramKb + swapKb) / 1024), Math.floor(diskKb / 1024), description.replace('_', ' '));
Math.floor((ramKb + swapKb) / 1024), Math.floor(diskKb / 1024), totalInstanceCount, description.replace('_', ' '));
break;
}
catch (err) {