fix: do not allow reusing the same scheme:host-port mappings when setting ports

This doesn't make sense as a port can't be listened to twice on the same domain, so instead we should just fail immediately if someone attempts to perform this action.

Refs dokku/dokku-letsencrypt#269
This commit is contained in:
Jose Diaz-Gonzalez
2024-02-25 11:10:36 -05:00
parent 412c841860
commit ba3ad4a9ab
5 changed files with 93 additions and 9 deletions

View File

@@ -6,9 +6,14 @@ import (
// PortMap is a struct that contains a scheme:host-port:container-port mapping
type PortMap struct {
ContainerPort int `json:"container_port"`
HostPort int `json:"host_port"`
Scheme string `json:"scheme"`
// ContainerPort is the port on the container
ContainerPort int `json:"container_port"`
// HostPort is the port on the host
HostPort int `json:"host_port"`
// Scheme is the scheme of the port mapping
Scheme string `json:"scheme"`
}
func (p PortMap) String() string {