Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing some of the server options #16

Merged
merged 4 commits into from
Dec 18, 2023

Conversation

tiennou
Copy link
Contributor

@tiennou tiennou commented Dec 12, 2023

This passes in a few whitelisted keys from config.yml to override defaults from the default .screepsrc file.

@tiennou tiennou force-pushed the feature/custom-server-options branch 3 times, most recently from 07627be to 769be9f Compare December 12, 2023 22:19
config.yml Outdated
@@ -1,6 +1,15 @@
mods:
- screepsmod-auth
- screepsmod-admin-utils
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be removed.

config.yml Outdated
Comment on lines 10 to 15
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a whitelist anyway, it should be following the same naming convention as the rest of the config. So runnerThreads and processorCount.

screeps-start.js Outdated

const keys = ['runner_threads', 'processors_cnt', 'log_console'];
for (const key of keys) {
if (options[key]) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line only overrides if the option is truthy. We should just check if it exists.

Suggested change
if (options[key]) {
if (key in options) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, just realised that this should not be checking options but config.serverConfig :)

This passes in a few whitelisted keys from config.yml to override
defaults from the default `.screepsrc` file.
@Jomik Jomik force-pushed the feature/custom-server-options branch from 769be9f to 061a3f9 Compare December 18, 2023 09:47
screeps-start.js Outdated

const keys = ['runner_threads', 'processors_cnt', 'log_console'];
for (const key of keys) {
if (options[key]) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, just realised that this should not be checking options but config.serverConfig :)

@Jomik Jomik merged commit cad9125 into Jomik:main Dec 18, 2023
0 of 2 checks passed
@tiennou tiennou deleted the feature/custom-server-options branch December 30, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants