From 5e309e764143c9e1dd4ba550147b7522fdb21622 Mon Sep 17 00:00:00 2001 From: Tugdual Saunier Date: Wed, 1 Feb 2023 15:39:55 -0500 Subject: [PATCH] Treat any service using usual HTTP ports as an HTTP service --- envs/docker.go | 6 ++++++ envs/envs.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/envs/docker.go b/envs/docker.go index a94edbe9..8b8eb9b6 100644 --- a/envs/docker.go +++ b/envs/docker.go @@ -429,6 +429,12 @@ func (l *Local) dockerServiceToRelationship(client *docker.Client, container typ "port": formatDockerPort(p.PublicPort), "rel": "simple", } + // Official HTTP(s) ports or well know alternatives + if p.PrivatePort == 80 || p.PrivatePort == 8008 || p.PrivatePort == 8080 || p.PrivatePort == 8081 { + rels[""]["scheme"] = "http" + } else if p.PrivatePort == 443 || p.PrivatePort == 8443 { + rels[""]["scheme"] = "https" + } return rels } diff --git a/envs/envs.go b/envs/envs.go index e12b2d57..88561569 100644 --- a/envs/envs.go +++ b/envs/envs.go @@ -269,7 +269,7 @@ func extractRelationshipsEnvs(env Environment) Envs { } else if rel == "mercure" { values["MERCURE_URL"] = fmt.Sprintf("%s://%s:%s/.well-known/mercure", endpoint["scheme"].(string), endpoint["host"].(string), formatInt(endpoint["port"])) values["MERCURE_PUBLIC_URL"] = values["MERCURE_URL"] - } else if scheme == "http" { + } else if scheme == "http" || scheme == "https" { username, hasUsername := endpoint["username"].(string) password, hasPassword := endpoint["password"].(string) if hasUsername || hasPassword {