serve grpc and http on the same socket
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
f3bbd44734
commit
39006d4cdd
10 changed files with 1109 additions and 18 deletions
|
@ -3,7 +3,6 @@ package server
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
|
@ -27,9 +26,8 @@ type CrioInfo struct {
|
|||
StorageRoot string `json:"storage_root"`
|
||||
}
|
||||
|
||||
// StartInfoEndpoints starts a http server that
|
||||
// serves container information requests and crio daemon information
|
||||
func (s *Server) StartInfoEndpoints(l net.Listener) error {
|
||||
// GetInfoMux returns the mux used to serve info requests
|
||||
func (s *Server) GetInfoMux() *bone.Mux {
|
||||
mux := bone.New()
|
||||
|
||||
mux.Get("/info", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
|
@ -77,5 +75,5 @@ func (s *Server) StartInfoEndpoints(l net.Listener) error {
|
|||
w.Write(js)
|
||||
}))
|
||||
|
||||
return http.Serve(l, mux)
|
||||
return mux
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue