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 committed 2024-02-25 11:11:23 -05:00
1 parent 412c841860
commit ba3ad4a9ab
5 files changed
+93 -9

No files matched your search

+4
View File
@@ -87,6 +87,8 @@ func TriggerPortsGet(appName string, format string) error {
persisted = append(persisted, portMap)
}
persisted = uniquePortMaps(persisted)
if format == "json" {
b, err := json.Marshal(persisted)
if err != nil {
@@ -207,6 +209,8 @@ func TriggerPostCertsUpdate(appName string) error {
}
}
http80Ports = uniquePortMaps(http80Ports)
if len(http80Ports) > 0 {
var https443Ports []PortMap
for _, portMap := range portMaps {