remove $PORT, use config for listen port
MCP's pasta port mapping maps host:randomport to container:routeport. The app must listen on the route's port (443) inside the container, configured via HTTP_PORT in kls.conf. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
14
main.go
14
main.go
@@ -6,7 +6,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
|
|
||||||
"git.wntrmute.dev/kyle/goutils/config"
|
"git.wntrmute.dev/kyle/goutils/config"
|
||||||
"git.wntrmute.dev/kyle/goutils/die"
|
"git.wntrmute.dev/kyle/goutils/die"
|
||||||
@@ -30,15 +29,10 @@ func main() {
|
|||||||
srv := &server{db: db}
|
srv := &server{db: db}
|
||||||
http.Handle("/", srv)
|
http.Handle("/", srv)
|
||||||
|
|
||||||
var addr string
|
addr := net.JoinHostPort(
|
||||||
if port := os.Getenv("PORT"); port != "" {
|
config.Get("HTTP_ADDR"),
|
||||||
addr = ":" + port
|
config.GetDefault("HTTP_PORT", "8000"),
|
||||||
} else {
|
)
|
||||||
addr = net.JoinHostPort(
|
|
||||||
config.Get("HTTP_ADDR"),
|
|
||||||
config.GetDefault("HTTP_PORT", "8000"),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
log.Print("listening on ", addr)
|
log.Print("listening on ", addr)
|
||||||
log.Fatal(http.ListenAndServe(addr, nil))
|
log.Fatal(http.ListenAndServe(addr, nil))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user