Add port metadata and placeholder support for container ports - #25
Conversation
…pdate) Mirror GladysAssistant/Gladys#2787: a declared sub-container port may carry an optional `name` ([a-z0-9_]{2,20}, unique across the whole manifest), which makes the host port Gladys assigned to it referenceable from the manifest section texts through the `{{port:<name>}}` placeholder — the OCPP case: showing the user "point your charge point to ws://{{gladys_host}}:{{port:ocpp}}", an address the server cannot build reliably but the browser knows by construction. - ContainerPort typings realigned on what GET /container actually returns: the new `name` (string | null), plus the `protocol`, `label` and `browsable` fields that were already sent but never typed, and `host_port` widened to `number | null` (no host port is assigned while the sub-container has never been started) - README: a "Placeholders in section texts" subsection (both tokens, the manifest-rejected unknown reference, the contact_schema refusal, the left-as-is unresolved token and the reverse-proxy limitation), a "Published ports" block in Sub-containers and the getContainers() row - tests: the sub-container fixture carries the full port shape, plus a case covering a named port with no assigned host port yet Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bb3mfS9ufKovY8WxwDk9VB
|
Warning Review limit reached
Next review available in: 36 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resolve the overlap with #24 (adaptation of GladysAssistant/Gladys#2786), which landed on main the port fields this branch had added on its own: keep main's version of `protocol`, `label`, `browsable` and the nullable `host_port` (its ContainerPortProtocol union and its direct-assignment type check are the stronger form), and keep only the delta specific to GladysAssistant/Gladys#2787 on top — the `name` field of ContainerPort, its JSDoc/README documentation and a dedicated test. - index.d.ts: `name: string | null` added to main's ContainerPort - getContainers JSDoc and the README port entry list `name` - README: the "Placeholders in section texts" subsection stays, the Sub-containers block explains `name` after main's `browsable` paragraph - tests: main's browsable/unassigned-port case kept as is, the port name gets its own case; the type test keeps both direct assignments Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bb3mfS9ufKovY8WxwDk9VB
Summary
This PR enhances the container port system to support dynamic URL generation in configuration sections through placeholder tokens. It adds metadata to published ports (protocol, label, name, browsable flag) and introduces
{{gladys_host}}and{{port:<name>}}placeholder substitution in section texts.Key Changes
Extended
ContainerPortinterface with new fields:protocol: Transport protocol ('tcp' or 'udp')label: Multi-language display name for the portname: Optional stable identifier for referencing ports in placeholdersbrowsable: Boolean flag indicating if a web UI link should be shownhost_porttype fromnumbertonumber | nullto represent unassigned portsAdded placeholder token support in section
labelanddescriptionfields:{{gladys_host}}: Resolves to the hostname the browser uses to reach Gladys{{port:<name>}}: Resolves to the assigned host port of a named container port{{port:<name>}}is forbidden incontact_schema, unassigned ports display as-isUpdated documentation with:
Updated tests to verify:
Updated TypeScript definitions to reflect the new
ContainerPortstructure and nullablehost_portImplementation Details
The changes enable integrations to dynamically display connection URLs to users without hardcoding addresses, solving the problem that servers cannot reliably determine which LAN address users reach them by. The browser-side placeholder resolution ensures accurate hostname and port information is shown in configuration screens.
https://claude.ai/code/session_01Bb3mfS9ufKovY8WxwDk9VB