Add common settings for Factorio servers

Add settings of interest to server administrators that appear in
server-settings.json to the factorio.settings config.  This makes it
easier to see which settings can be set there.
This commit is contained in:
Hornwitser committed 2021-01-18 08:17:14 +01:00
1 parent 201eb89dcd
commit b84c5b4293
3 files changed
+43 -4

No files matched your search

+8
View File
@@ -5,6 +5,14 @@ Configuration
Master Configuration
--------------------
### master.name
Name of the cluster. Used to distinguish it from other clusters and is
prepended to the name of servers in the server list.
Defaluts to "Your Cluster".
### master.database_directory
Directory used to store cluster data to. Needs to be writeable by the
+8 -4
View File
@@ -11,6 +11,13 @@ const classes = require("./classes");
*/
class MasterGroup extends classes.ConfigGroup { }
MasterGroup.groupName = "master";
MasterGroup.define({
name: "name",
title: "Name",
description: "Name of the cluster",
type: "string",
initial_value: "Your Cluster",
});
MasterGroup.define({
name: "database_directory",
title: "Database directory",
@@ -262,10 +269,7 @@ FactorioGroup.define({
name: "settings",
description: "Settings overridden in server-settings.json",
type: "object",
initial_value: {
"tags": ["clusterio"],
"auto_pause": false,
},
initial_value: {}, // See create instance handler in master.
});
FactorioGroup.define({
name: "verbose_logging",
+27
View File
@@ -741,6 +741,33 @@ class ControlConnection extends BaseConnection {
if (db.instances.has(instanceId)) {
throw new libErrors.RequestError(`Instance with ID ${instanceId} already exists`);
}
// Add common settings for the Factorio server
let settings = {
"name": `${masterConfig.get("master.name")} - ${instanceConfig.get("instance.name")}`,
"description": `Clusterio instance for ${masterConfig.get("master.name")}`,
"tags": ["clusterio"],
"max_players": 0,
"visibility": { "public": true, "lan": true },
"username": "",
"token": "",
"game_password": "",
"require_user_verification": true,
"max_upload_in_kilobytes_per_second": 0,
"max_upload_slots": 5,
"ignore_player_limit_for_returning_players": false,
"allow_commands": "admins-only",
"autosave_interval": 10,
"autosave_slots": 5,
"afk_autokick_interval": 0,
"auto_pause": false,
"only_admins_can_pause_the_game": true,
"autosave_only_on_server": true,
...instanceConfig.get("factorio.settings"),
};
instanceConfig.set("factorio.settings", settings);
db.instances.set(instanceId, { config: instanceConfig, status: "unassigned" });
}