mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Option to specify rippled path on command line.
* --rippled=<absolute or relative path> * Works for "npm test" and "mocha" * Remove "rippled_path" from config.js to require CLI path.
This commit is contained in:
committed by
Vinnie Falco
parent
a9dfb33126
commit
b725410623
@@ -87,7 +87,22 @@ Server.prototype.set_ledger_file = function(fn) {
|
|||||||
Server.prototype._serverSpawnSync = function() {
|
Server.prototype._serverSpawnSync = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var path = this.config.rippled_path;
|
var rippledpath = this.config.rippled_path;
|
||||||
|
// Override the config with command line if provided
|
||||||
|
if (process.env["npm_config_rippled"]) {
|
||||||
|
rippledpath = path.resolve(process.cwd(),
|
||||||
|
process.env["npm_config_rippled"]);
|
||||||
|
} else {
|
||||||
|
for (var i = process.argv.length-1; i >= 0; --i) {
|
||||||
|
arg = process.argv[i].split("=", 2);
|
||||||
|
if (arg.length === 2 && arg[0] === "--rippled") {
|
||||||
|
rippledpath = path.resolve(process.cwd(), arg[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
assert(rippledpath, "rippled_path not provided");
|
||||||
|
|
||||||
var args = [
|
var args = [
|
||||||
"-a",
|
"-a",
|
||||||
"-v",
|
"-v",
|
||||||
@@ -108,12 +123,12 @@ Server.prototype._serverSpawnSync = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Spawn in standalone mode for now.
|
// Spawn in standalone mode for now.
|
||||||
this.child = child.spawn(path, args, options);
|
this.child = child.spawn(rippledpath, args, options);
|
||||||
|
|
||||||
if (!this.quiet)
|
if (!this.quiet)
|
||||||
console.log("server: start %s: %s --conf=%s",
|
console.log("server: start %s: %s --conf=%s",
|
||||||
this.child.pid,
|
this.child.pid,
|
||||||
this.config.rippled_path,
|
rippledpath,
|
||||||
args.join(" "),
|
args.join(" "),
|
||||||
this.configPath());
|
this.configPath());
|
||||||
|
|
||||||
@@ -144,11 +159,11 @@ Server.prototype._serverSpawnSync = function() {
|
|||||||
|
|
||||||
// Prepare server's working directory.
|
// Prepare server's working directory.
|
||||||
Server.prototype._makeBase = function (done) {
|
Server.prototype._makeBase = function (done) {
|
||||||
var path = this.serverPath();
|
var serverpath = this.serverPath();
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// Reset the server directory, build it if needed.
|
// Reset the server directory, build it if needed.
|
||||||
nodeutils.resetPath(path, '0777', function (e) {
|
nodeutils.resetPath(serverpath, '0777', function (e) {
|
||||||
if (e) throw e;
|
if (e) throw e;
|
||||||
self._writeConfig(done);
|
self._writeConfig(done);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user