mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 14:35:52 +00:00
Build testing newcoind.cfg as needed.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -20,3 +20,6 @@ newcoind
|
|||||||
|
|
||||||
# Ignore locally installed node_modules
|
# Ignore locally installed node_modules
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
# Ignore tmp directory.
|
||||||
|
tmp
|
||||||
|
|||||||
15
test/config.js
Normal file
15
test/config.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// Configuration for unit tests
|
||||||
|
//
|
||||||
|
|
||||||
|
exports.servers = {
|
||||||
|
alpha : {
|
||||||
|
"peer_ip" : "0.0.0.0",
|
||||||
|
"peer_port" : 51235,
|
||||||
|
"websocket_ip" : "127.0.0.1",
|
||||||
|
"websocket_port" : 5005,
|
||||||
|
"validation_seed" : "shhDFVsmS2GSu5vUyZSPXYfj1r79h",
|
||||||
|
"validators" : "n9L8LZZCwsdXzKUN9zoVxs4YznYXZ9hEhsQZY7aVpxtFaSceiyDZ beta"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// vim:ts=4
|
||||||
@@ -7,21 +7,46 @@
|
|||||||
|
|
||||||
console.log("server.js>");
|
console.log("server.js>");
|
||||||
|
|
||||||
|
var config = require("./config.js");
|
||||||
var utils = require("./utils.js");
|
var utils = require("./utils.js");
|
||||||
|
|
||||||
|
var fs = require("fs");
|
||||||
|
var path = require("path");
|
||||||
|
var util = require("util");
|
||||||
// var child = require("child");
|
// var child = require("child");
|
||||||
|
|
||||||
var serverPath = function(name) {
|
var serverPath = function(name) {
|
||||||
return "tmp/server/" + name;
|
return "tmp/server/" + name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Return a server's newcoind.cfg as string.
|
||||||
|
var serverConfig = function(name) {
|
||||||
|
var cfg = config.servers[name];
|
||||||
|
|
||||||
|
return Object.keys(cfg).map(function (o) {
|
||||||
|
return util.format("[%s]\n%s\n", o, cfg[o]);
|
||||||
|
}).join("");
|
||||||
|
};
|
||||||
|
|
||||||
|
// Write a server's newcoind.cfg.
|
||||||
|
var writeConfig = function(name, done) {
|
||||||
|
fs.writeFile(path.join(serverPath(name), "newcoind.cfg"), serverConfig(name), 'utf8', done);
|
||||||
|
};
|
||||||
|
|
||||||
var makeBase = function(name, done) {
|
var makeBase = function(name, done) {
|
||||||
var path = serverPath(name);
|
var path = serverPath(name);
|
||||||
|
|
||||||
console.log("start> %s: %s", name, path);
|
console.log("start> %s: %s", name, path);
|
||||||
|
|
||||||
// Remove the existing dir.
|
// Reset the server directory, build it if needed.
|
||||||
utils.resetPath(path, parseInt('0777', 8), done);
|
utils.resetPath(path, parseInt('0777', 8), function (e) {
|
||||||
|
if (e) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
writeConfig(name, done);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
console.log("start< %s", name);
|
console.log("start< %s", name);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user