Remove port and password arguments to client.js

Remove undocumented command line options set the ports and password used
in the instance.  These are not compatible with remote management.
This commit is contained in:
Hornwitser committed 2019-11-20 22:36:14 +01:00
1 parent 0474355175
commit 1d26212e1d
3 files changed
+14 -17

No files matched your search

+3
View File
@@ -41,6 +41,9 @@ Version 2.0.0
/api/inventory, /api/inventoryAsObject and the web interface view for the /api/inventory, /api/inventoryAsObject and the web interface view for the
storage page into the clusterioMod plugin. If you disable this plugin storage page into the clusterioMod plugin. If you disable this plugin
then these things will not be available. then these things will not be available.
- Removed undocumented --port and --rcon-port arguments to client.
- Removed undocumented FACTORIOPORT and RCONPORT enviroment variable
handling in client.
### Breaking Changes ### Breaking Changes
+1 -1
View File
@@ -18,4 +18,4 @@ VOLUME /factorioClusterio/instances
VOLUME /factorioClusterio/sharedMods VOLUME /factorioClusterio/sharedMods
VOLUME /factorioClusterio/sharedPlugins VOLUME /factorioClusterio/sharedPlugins
CMD RCONPORT="$RCONPORT" FACTORIOPORT="$FACTORIOPORT" MODE="$MODE" node $MODE start $INSTANCE CMD MODE="$MODE" node $MODE start $INSTANCE
+10 -16
View File
@@ -270,7 +270,7 @@ async function symlinkMods(instance, sharedMods, logger) {
} }
} }
async function createInstance(config, args, instance) { async function createInstance(config, instance) {
console.log(`Creating ${instance.path()}`); console.log(`Creating ${instance.path()}`);
await fs.ensureDir(instance.path()); await fs.ensureDir(instance.path());
await fs.ensureDir(instance.path("script-output")); await fs.ensureDir(instance.path("script-output"));
@@ -278,10 +278,10 @@ async function createInstance(config, args, instance) {
await symlinkMods(instance, "sharedMods", console); await symlinkMods(instance, "sharedMods", console);
let instconf = { let instconf = {
"id": Math.random() * 2 ** 31 | 0, "id": Math.random() * 2 ** 31 | 0,
"factorioPort": args.port || process.env.FACTORIOPORT || null, "factorioPort": null,
"clientPort": args["rcon-port"] || process.env.RCONPORT || null, "clientPort": null,
"__comment_clientPassword": "This is the rcon password. Will be randomly generated if null.", "__comment_clientPassword": "This is the rcon password. Will be randomly generated if null.",
"clientPassword": args["rcon-password"] || null, "clientPassword": null,
"info": {} "info": {}
} }
console.log("Clusterio | Created instance with settings:") console.log("Clusterio | Created instance with settings:")
@@ -335,7 +335,7 @@ async function createInstance(config, args, instance) {
console.log("Clusterio | Successfully created instance"); console.log("Clusterio | Successfully created instance");
} }
async function startInstance(config, args, instance) { async function startInstance(config, instance) {
var instanceconfig = JSON.parse(await fs.readFile(instance.path("config.json"))); var instanceconfig = JSON.parse(await fs.readFile(instance.path("config.json")));
if (typeof instanceconfig.id !== "number" || isNaN(instanceconfig.id)) { if (typeof instanceconfig.id !== "number" || isNaN(instanceconfig.id)) {
throw new Error(`${instance.path("config.json")} is missing id`); throw new Error(`${instance.path("config.json")} is missing id`);
@@ -343,12 +343,6 @@ async function startInstance(config, args, instance) {
// Temporary measure for backwards compatibility // Temporary measure for backwards compatibility
instanceconfig.unique = instanceconfig.id; instanceconfig.unique = instanceconfig.id;
if (process.env.FACTORIOPORT) {
instanceconfig.factorioPort = process.env.FACTORIOPORT;
}
if (process.env.RCONPORT) {
instanceconfig.rconPort = process.env.RCONPORT;
}
console.log("Deleting .tmp.zip files"); console.log("Deleting .tmp.zip files");
let savefiles = fs.readdirSync(instance.path("saves")); let savefiles = fs.readdirSync(instance.path("saves"));
for(i = 0; i < savefiles.length; i++){ for(i = 0; i < savefiles.length; i++){
@@ -419,9 +413,9 @@ async function startInstance(config, args, instance) {
await factorio.patch(instance.path("saves", latestSave), modules); await factorio.patch(instance.path("saves", latestSave), modules);
let options = { let options = {
gamePort: args.port || Number(process.env.FACTORIOPORT) || instanceconfig.factorioPort, gamePort: instanceconfig.factorioPort,
rconPort: args["rcon-port"] || Number(process.env.RCONPORT) || instanceconfig.clientPort, rconPort: instanceconfig.clientPort,
rconPassword: args["rcon-password"] || instanceconfig.clientPassword, rconPassword: instanceconfig.clientPassword,
}; };
let server = new factorio.FactorioServer(path.join("factorio", "data"), instance.path(), options); let server = new factorio.FactorioServer(path.join("factorio", "data"), instance.path(), options);
@@ -526,9 +520,9 @@ async function startClient() {
console.error("Usage: node client start [instanceName]"); console.error("Usage: node client start [instanceName]");
process.exit(0); process.exit(0);
} else if (command == "start" && !fs.existsSync(instance.path())) { } else if (command == "start" && !fs.existsSync(instance.path())) {
await createInstance(config, args, instance); await createInstance(config, instance);
} else if (command == "start" && fs.existsSync(instance.path())) { } else if (command == "start" && fs.existsSync(instance.path())) {
await startInstance(config, args, instance); await startInstance(config, instance);
} else { } else {
console.error("Invalid arguments, quitting."); console.error("Invalid arguments, quitting.");
process.exit(1); process.exit(1);