Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d3c174d9b0 | |||
| 0ecea29413 | |||
| 06d469abaf | |||
| a94b92f7fd |
@@ -9,10 +9,6 @@ kls = "Dockerfile"
|
|||||||
[[components]]
|
[[components]]
|
||||||
name = "kls"
|
name = "kls"
|
||||||
image = "mcr.svc.mcp.metacircular.net:8443/kls:v0.1.0"
|
image = "mcr.svc.mcp.metacircular.net:8443/kls:v0.1.0"
|
||||||
network = "mcpnet"
|
|
||||||
user = "0:0"
|
|
||||||
restart = "unless-stopped"
|
|
||||||
ports = ["127.0.0.1:48000:8000"]
|
|
||||||
volumes = ["/srv/kls:/srv/kls"]
|
volumes = ["/srv/kls:/srv/kls"]
|
||||||
cmd = ["-f", "/srv/kls/kls.conf"]
|
cmd = ["-f", "/srv/kls/kls.conf"]
|
||||||
|
|
||||||
|
|||||||
14
main.go
14
main.go
@@ -30,15 +30,13 @@ func main() {
|
|||||||
srv := &server{db: db}
|
srv := &server{db: db}
|
||||||
http.Handle("/", srv)
|
http.Handle("/", srv)
|
||||||
|
|
||||||
var addr string
|
// $PORT is set by the MCP agent for containers with route declarations.
|
||||||
if port := os.Getenv("PORT"); port != "" {
|
// It takes precedence over config, matching the mcdsl convention.
|
||||||
addr = ":" + port
|
port := os.Getenv("PORT")
|
||||||
} else {
|
if port == "" {
|
||||||
addr = net.JoinHostPort(
|
port = config.GetDefault("HTTP_PORT", "8000")
|
||||||
config.Get("HTTP_ADDR"),
|
|
||||||
config.GetDefault("HTTP_PORT", "8000"),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
addr := net.JoinHostPort(config.Get("HTTP_ADDR"), port)
|
||||||
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