Introduce PortManager to manage service ports
What does this Merge Request do and why?
This MR introduces GDK::PortManager
which:
- Is the single source of truth for the TCP ports the GDK uses
- Validates there isn't a port clash when attempting to change a port's value
- Allows each TCP port to be inspected to determine if they're in use (not yet wired up)
Examples
$ gdk config set port 9000
❌️ ERROR: Value '9000' for setting 'port' is not a valid port - Port 9000 is already allocated for service 'object_store'.
# edited gdk.yml to set `port: 9000`
$ gdk config get port
❌️ ERROR: Your gdk.yml is invalid.
Value '9000' for setting 'port' is not a valid port - Port 9000 is already allocated for service 'object_store'.
$ gdk config get port
❌️ ERROR: Your gdk.yml is invalid.
Service 'port_not_defined' is unknown, please add to GDK::PortManager::DEFAULT_PORTS_FOR_SERVICES
Closes: #1581 (closed)
Merge Request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise Issue to follow-up. -
Documentation added/updated, if needed. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.
Edited by Ash McKenzie