mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 03:17:50 +00:00
Really fix url on Web UI log
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
This commit is contained in:
parent
88f13d5e8b
commit
1f234df86e
3 changed files with 7 additions and 4 deletions
|
|
@ -67,6 +67,8 @@ type Handler struct {
|
|||
api *pilosa.API
|
||||
|
||||
ln net.Listener
|
||||
// Needed real URL for a log
|
||||
url string
|
||||
|
||||
closeTimeout time.Duration
|
||||
|
||||
|
|
@ -135,9 +137,10 @@ func OptHandlerLogger(logger logger.Logger) handlerOption {
|
|||
}
|
||||
}
|
||||
|
||||
func OptHandlerListener(ln net.Listener) handlerOption {
|
||||
func OptHandlerListener(ln net.Listener, url string) handlerOption {
|
||||
return func(h *Handler) error {
|
||||
h.ln = ln
|
||||
h.url = url
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
@ -502,7 +505,7 @@ type statikHandler struct {
|
|||
func newStatikHandler(h *Handler) statikHandler {
|
||||
fs, err := h.fileSystem.New()
|
||||
if err == nil {
|
||||
h.logger.Printf("enabled Web UI (%s) at %s", h.api.LatticeVersion(), h.ln.Addr().String())
|
||||
h.logger.Printf("enabled Web UI (%s) at %s", h.api.LatticeVersion(), h.url)
|
||||
}
|
||||
|
||||
return statikHandler{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ func TestHandlerOptions(t *testing.T) {
|
|||
return err
|
||||
}, 10)
|
||||
|
||||
_, err = http.NewHandler(http.OptHandlerListener(ln))
|
||||
_, err = http.NewHandler(http.OptHandlerListener(ln, ln.Addr().String()))
|
||||
if err == nil {
|
||||
t.Fatalf("expected error making handler without options, got nil")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ func (m *Command) SetupServer() error {
|
|||
http.OptHandlerAPI(m.API),
|
||||
http.OptHandlerLogger(m.logger),
|
||||
http.OptHandlerFileSystem(&statik.FileSystem{}),
|
||||
http.OptHandlerListener(m.ln),
|
||||
http.OptHandlerListener(m.ln, uri.HostPort()),
|
||||
http.OptHandlerCloseTimeout(m.closeTimeout),
|
||||
http.OptHandlerMiddleware(m.grpcServer.middleware(m.Config.Handler.AllowedOrigins)),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue