Skip to content

Commit

Permalink
Allow customizing some of the server options
Browse files Browse the repository at this point in the history
This passes in a few whitelisted keys from config.yml to override
defaults from the default `.screepsrc` file.
  • Loading branch information
tiennou committed Dec 12, 2023
1 parent b6debba commit 769be9f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
11 changes: 10 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
mods:
- screepsmod-auth
- screepsmod-admin-utils
- screepsmod-mongo
bots:
simplebot: screepsbot-zeswarm

serverConfig:
# The number of parallel runner threads in which player scripts are executed.
# Don't set this option greater than the number of your physical CPU cores.
runner_threads: 4
# The number of room processor worker processes to launch.
# Don't set this option greater than the number of your physical CPU cores.
processors_cnt: 2
# If set, forward console messages to terminal
log_console: false
17 changes: 13 additions & 4 deletions screeps-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,20 @@ const start = async () => {
writeModsConfiguration();

const screeps = require("@screeps/launcher");
const options = {
steam_api_key: process.env.STEAM_KEY || config.steamKey,
storage_disable: false,
};

const keys = ['runner_threads', 'processors_cnt', 'log_console'];
for (const key of keys) {
if (options[key]) {
options[key] = config.serverConfig[key];
}
}

await screeps.start(
{
steam_api_key: process.env.STEAM_KEY || config.steamKey,
storage_disable: false,
},
options,
process.stdout,
);
};
Expand Down

0 comments on commit 769be9f

Please sign in to comment.