-
Couldn't load subscription status.
- Fork 0
Description
There’s a bug in the configchanger package where integer fields in the JsonConfig struct (e.g., DiscordCharBufferSize, BackupKeepLastN) are not properly persisted when updated via the UI or REST API. This is also the reason why the Discord Track in the setup was broken (removed in 5.4.31)
In SaveConfigForm (configuration.go), the switch fieldType.Kind() block lacks a reflect.Int case, so form submissions for int fields are ignored, and existing/default values persist in the config file.
In SaveConfigRestful, reflect.Int is handled but may skip invalid or empty string inputs, potentially failing to update int fields from JSON requests.
Impact: Integer fields loaded from the JSON config file apply correctly at runtime via LoadConfig and applyConfig.
However, updates to these fields via REST API (or form if added to UI) do not persist to the config file, causing them to revert to the default / set value in the config.json on the next config load.
This was noticed when considering adding a UI field for AutoRestartServerTimer, which was made a string to avoid this issue.
Current Workaround: Currently, no integer fields are exposed in the UI, and int fields like AutoRestartServerTimer are kept as strings to ensure persistence and functionality. This avoids the bug since string fields are handled correctly.
Resolution: Not planning to fix this in StationeersServerUI since no int fields are exposed in the UI, and string-based fields (e.g., ServerMaxPlayers, AutoRestartServerTimer) work fine. The bug has already been fixed in SteamServerUI.