restore $PORT support, remove explicit ports mapping

The MCP agent assigns its own host port and sets $PORT. The app must
listen on $PORT for mc-proxy to reach it. Explicit Podman port mappings
in the service definition are ignored by the agent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-27 17:01:29 -07:00
parent a94b92f7fd
commit 06d469abaf
2 changed files with 10 additions and 8 deletions

14
main.go
View File

@@ -6,6 +6,7 @@ import (
"log"
"net"
"net/http"
"os"
"git.wntrmute.dev/kyle/goutils/config"
"git.wntrmute.dev/kyle/goutils/die"
@@ -29,10 +30,15 @@ func main() {
srv := &server{db: db}
http.Handle("/", srv)
addr := net.JoinHostPort(
config.Get("HTTP_ADDR"),
config.GetDefault("HTTP_PORT", "8000"),
)
var addr string
if port := os.Getenv("PORT"); port != "" {
addr = ":" + port
} else {
addr = net.JoinHostPort(
config.Get("HTTP_ADDR"),
config.GetDefault("HTTP_PORT", "8000"),
)
}
log.Print("listening on ", addr)
log.Fatal(http.ListenAndServe(addr, nil))
}