-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feature: Additional Allocations #2
Conversation
… screenshot and cleaned up code
…nor readme update.
One thing for me to change before merge, based on feedback from kubi: change activity log calls to module log |
Temporarily converted to draft while I add support to use the additional allocations in the startup string parameter. |
…Added support for setting environment parameters
Feature: Assign allocations to environment variables
Updated the description for additional_ports config option
New commits added: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! From a quick glance, I'd recommend the following changes. I'll try to play around with this locally during the next week.
… regarding allocations
…backwards compatibility
Thanks for the review Trixter - I've gone through and fixed the issues you mentioned, happy to make any further changes as necessary. Look forward to hearing back whenever you or the team get a chance to play around with it 👍 |
Will this be merged? |
Update? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the bugs I found at snags141#6
Fetches and returns all nodes with a specific location_id | ||
*/ | ||
$filteredNodes = Array(); | ||
$nodes = wisp_API($params, 'nodes/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nodes/
endpoint should be changed to nodes
since wispv2 returns an error when using nodes/
| ------------ | ------------ | ------------ | ------------ | | ||
| Rust | Game port and RCON port | `{1:"RCON_PORT"}` | Game Port: 1000, RCON_PORT: 1001| | ||
| Arma 3 | Game port, Game port +1 for Steam Query, Game port + 2 for Steam Port, and Game port +4 for BattleEye | `{1:"NONE", 2:"NONE", 4:"NONE"}` | Game Port: 1000, Additional Ports: 1001, 1002, 1004 | | ||
| Unturned | Game port, Game port +1 and Game port +2 | `{1:"NONE", 2:"NONE"}` | Game Port: 1000, Additional Ports: 1001, 1002 | | ||
| Project Zomboid | Game Port, Steam port and an additional port for every player. Let's say we want 10 additional ports for 10 players. | `{1:"STEAM_PORT", 2:"NONE", 3:"NONE", 4:"NONE", 5:"NONE", 6:"NONE", 7:"NONE", 8:"NONE", 9:"NONE", 10:"NONE", 11:"NONE"}` | Game Port: 1000, Steam Port: 1001, Additional Ports: 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011| | ||
|
||
**What does "NONE" mean?** | ||
"NONE" means you want to assign the additional port to the server, but it doesn't need to be assigned to a server parameter. If instead you want to add a +1 port and assign it to the parameter "RCON_PORT" then you'd use `{1:"RCON_PORT"}` for example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That json isn't valid.
keys should be strings
for example:
{"1":"RCON_PORT"}
|
||
(If they're available) | ||
|
||
Note: I this option is set, it will override anything specified under "port_range" - Use one or the other, not both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
|
||
(If they're available) | ||
|
||
Note: I this option is set, it will override anything specified under "port_range" - Use one or the other, not both. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not only override port_range but also every under deploy.
That should be dedicated IP, location and port_range
$main_allocation_id = $portDetails['id']; | ||
$main_allocation_port = $port; | ||
$found_all = true; | ||
foreach($port_offsets_array as $key => $port_offset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Foreach key and value are swapped
There the key (which you use as port offset) is used as parameter name and the value (which you use as parameter name) is used as port offset.
// Failed to find available set of ports based on requirements | ||
logModuleCall("WISP-WHMCS", "Failed to find available ports!", "", ""); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that shouldn't be in the for loop
Thank you so much for laying the foundation for this - I've made a new PR within wisp-gg/whmcs which carries on your work, since I can't edit your repo/pr obviously. Closing in favour of #8 |
Changed:
Added:
Allocation Assignment Logic
(Assuming the optional additional allocations parameter has been set, otherwise continues as normal)
Other Notes
The only minor thing to be aware of is the logic I've implemented pays no attention to the optional field "port_range".
If "additional_ports" is set, it'll just find any ports available that meet your requirements, ignoring any specified port range in the "port_range" parameter.
It's possible to change this in future, but I didn't see this as being an issue and using both parameters together seems to be a rare use-case.
More than happy to hear any feedback or suggestions to improve this before merge 👍
Cheers all!