Skip to content

Commit 18cfdab

Browse files
committed
Enable manhole on pinecone
1 parent b215925 commit 18cfdab

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ COPY --from=base /build/bin/* /usr/bin/
2020
EXPOSE 65432/tcp
2121
EXPOSE 65433/tcp
2222

23-
ENTRYPOINT ["/usr/bin/pinecone", "-listenws=:65433", "-listen=:65432"]
23+
ENTRYPOINT ["/usr/bin/pinecone", "-listenws=:65433", "-listen=:65432", "-manhole"]

cmd/pinecone/main.go

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func main() {
6262
listentcp := flag.String("listen", ":0", "address to listen for TCP connections")
6363
listenws := flag.String("listenws", ":0", "address to listen for WebSockets connections")
6464
connect := flag.String("connect", "", "peer to connect to")
65+
manhole := flag.Bool("manhole", false, "enable the manhole (requires WebSocket listener to be active)")
6566
flag.Parse()
6667

6768
if connect != nil && *connect != "" {
@@ -91,6 +92,13 @@ func main() {
9192
}
9293
})
9394

95+
if *manhole {
96+
fmt.Println("Enabling manhole on HTTP listener")
97+
http.DefaultServeMux.HandleFunc("/manhole", func(w http.ResponseWriter, r *http.Request) {
98+
pineconeRouter.ManholeHandler(w, r)
99+
})
100+
}
101+
94102
listener, err := listener.Listen(context.Background(), "tcp", *listenws)
95103
if err != nil {
96104
panic(err)

0 commit comments

Comments
 (0)