Skip to content

Commit

Permalink
Enable manhole on pinecone
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Sep 13, 2022
1 parent b215925 commit 18cfdab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ COPY --from=base /build/bin/* /usr/bin/
EXPOSE 65432/tcp
EXPOSE 65433/tcp

ENTRYPOINT ["/usr/bin/pinecone", "-listenws=:65433", "-listen=:65432"]
ENTRYPOINT ["/usr/bin/pinecone", "-listenws=:65433", "-listen=:65432", "-manhole"]
8 changes: 8 additions & 0 deletions cmd/pinecone/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func main() {
listentcp := flag.String("listen", ":0", "address to listen for TCP connections")
listenws := flag.String("listenws", ":0", "address to listen for WebSockets connections")
connect := flag.String("connect", "", "peer to connect to")
manhole := flag.Bool("manhole", false, "enable the manhole (requires WebSocket listener to be active)")
flag.Parse()

if connect != nil && *connect != "" {
Expand Down Expand Up @@ -91,6 +92,13 @@ func main() {
}
})

if *manhole {
fmt.Println("Enabling manhole on HTTP listener")
http.DefaultServeMux.HandleFunc("/manhole", func(w http.ResponseWriter, r *http.Request) {
pineconeRouter.ManholeHandler(w, r)
})
}

listener, err := listener.Listen(context.Background(), "tcp", *listenws)
if err != nil {
panic(err)
Expand Down

0 comments on commit 18cfdab

Please sign in to comment.