Conversation
…pendency Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] The last change was kind of problematic. The gabs server usually is started by an AI so giving people instructions on how to set env variables for port ranges before starting it manually makes little sense. Revert the change that gets the custom port r...
Replace environment variable port ranges with config-based solution
Sep 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The previous implementation used
GABS_PORT_RANGESenvironment variable to configure custom port ranges, which was problematic because:Users reported getting "no available ports in range 49152-65535" errors even with DirectPath launch mode, because the environment variable wasn't set.
Solution
This PR replaces the environment variable approach with a config-based solution that integrates port range configuration directly into the main
config.jsonfile.Key Changes
Configuration Structure
{ "version": "1.0", "portRanges": { "customRanges": [ {"min": 8000, "max": 8999}, {"min": 9000, "max": 9999} ] }, "games": { "rimworld": { "id": "rimworld", "name": "RimWorld", "launchMode": "DirectPath", "target": "C:\\Program Files (x86)\\Steam\\steamapps\\common\\RimWorld\\RimWorldWin64.exe" } } }Implementation Details
PortRangeandPortRangeConfigstructs with JSON serializationGamesConfigwith optionalportRangesfieldWriteBridgeJSONWithConfig()that accepts games configurationstartGame()to pass configuration to bridge creationfindAvailablePortWithFallback()withfindAvailablePortWithConfig()getCustomPortRanges()environment variable parsingDirectPath Clarification
The user's confusion about DirectPath mode was addressed - all launch modes require GABP bridge configuration for game communication, regardless of how the game is launched. The port allocation happens for Steam, Epic, DirectPath, and CustomCommand modes because they all need the bridge for AI-game communication.
Benefits
Testing
This change makes GABS much more user-friendly for both manual and automated deployment scenarios.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.