Skip to content

Commit

Permalink
Update conf file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Asherda committed Oct 12, 2023
1 parent b819164 commit 90a6ada
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
23 changes: 21 additions & 2 deletions routes/api/daemonControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = (api) => {
api.writeRpcUser = (confFile) => {
return new Promise((resolve, reject) => {
api.log(`creating rpcuser for ${confFile}...`, "native.process");
fs.appendFile(confFile, '\nrpcuser=verusdesktop')
fs.appendFile(confFile, `\nrpcuser=${generateRpcPassword()}`)
.then(resolve)
.catch(e => reject(e))
})
Expand All @@ -72,7 +72,22 @@ module.exports = (api) => {
.catch(e => reject(e))
})
}

api.writeRpcHost = (confFile) => {
return new Promise((resolve, reject) => {
api.log(`setting rpchost for ${confFile}...`, "native.process");
fs.appendFile(confFile, '\nrpchost=127.0.0.1')
.then(resolve)
.catch(e => reject(e))
})
}
api.writeRpcAllowIP = (confFile) => {
return new Promise((resolve, reject) => {
api.log(`setting rpcallowip for ${confFile}...`, "native.process");
fs.appendFile(confFile, '\nrpcallowip=127.0.0.1')
.then(resolve)
.catch(e => reject(e))
})
}
api.writeRpcPort = (coin, confFile, fallbackPort) => {
return new Promise((resolve, reject) => {
api.log(`creating rpcport for ${confFile}...`, "native.process");
Expand Down Expand Up @@ -220,13 +235,17 @@ module.exports = (api) => {
api.confFileIndex[coin] = confFile;
if (coin === 'VRSCTEST') {
return Promise.all([
api.writeRpcHost(confFile),
api.writeRpcAllowIP(confFile),
api.writeRpcPort(coin, confFile, fallbackPort),
api.writeRpcPassword(confFile),
api.writeRpcUser(confFile),
api.writeAC_Supply(confFile)
]);
} else {
return Promise.all([
api.writeRpcHost(confFile),
api.writeRpcAllowIP(confFile),
api.writeRpcPort(coin, confFile, fallbackPort),
api.writeRpcPassword(confFile),
api.writeRpcUser(confFile)
Expand Down
17 changes: 9 additions & 8 deletions routes/api/native/verusbridge/vethconf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const os = require("os");
const path = require("path");
var ini = require("ini");
const fixPath = require("fix-path");
const {generateRpcPassword} = require("../../utils/auth/rpcAuth");

const INIKeys = {
rpcuser: "",
Expand Down Expand Up @@ -38,24 +39,24 @@ const vethFolder = {

const RPCDefault = {
VRSCTEST: {
rpcuser: "user",
rpcpassword: "password",
rpcport: 8000,
rpcuser: `${generateRpcPassword()}`,
rpcpassword: `${generateRpcPassword()}`,
rpcport: 8002,
rpchost: "127.0.0.1",
delegatorcontractaddress: "empty",
testnet: true,
privatekey: "empty",
ethnode: "empty",
ethnode: "wss://goerli.infura.io/ws/v3/........",
},
VRSC: {
rpcuser: "username",
rpcpassword: "password",
rpcport: 8000,
rpcuser: `${generateRpcPassword()}`,
rpcpassword: `${generateRpcPassword()}`,
rpcport: 8002,
rpchost: "127.0.0.1",
delegatorcontractaddress: "empty",
testnet: false,
privatekey: "empty",
ethnode: "wss://rinkeby.infura.io/ws/v3/........",
ethnode: "wss://mainnet.infura.io/ws/v3/........",
},
};

Expand Down

0 comments on commit 90a6ada

Please sign in to comment.