mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
agent: Pass UiDir into the HTTP layer
This commit is contained in:
parent
f9ff14531f
commit
2739abab7b
@ -180,7 +180,7 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer, logWriter *log
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
server, err := NewHTTPServer(agent, config.EnableDebug, logOutput, httpAddr.String())
|
server, err := NewHTTPServer(agent, config.UiDir, config.EnableDebug, logOutput, httpAddr.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
agent.Shutdown()
|
agent.Shutdown()
|
||||||
c.Ui.Error(fmt.Sprintf("Error starting http server: %s", err))
|
c.Ui.Error(fmt.Sprintf("Error starting http server: %s", err))
|
||||||
|
@ -21,11 +21,12 @@ type HTTPServer struct {
|
|||||||
mux *http.ServeMux
|
mux *http.ServeMux
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
|
uiDir string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHTTPServer starts a new HTTP server to provide an interface to
|
// NewHTTPServer starts a new HTTP server to provide an interface to
|
||||||
// the agent.
|
// the agent.
|
||||||
func NewHTTPServer(agent *Agent, enableDebug bool, logOutput io.Writer, bind string) (*HTTPServer, error) {
|
func NewHTTPServer(agent *Agent, uiDir string, enableDebug bool, logOutput io.Writer, bind string) (*HTTPServer, error) {
|
||||||
// Create the mux
|
// Create the mux
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ func makeHTTPServer(t *testing.T) (string, *HTTPServer) {
|
|||||||
conf := nextConfig()
|
conf := nextConfig()
|
||||||
dir, agent := makeAgent(t, conf)
|
dir, agent := makeAgent(t, conf)
|
||||||
addr, _ := agent.config.ClientListener(agent.config.Ports.HTTP)
|
addr, _ := agent.config.ClientListener(agent.config.Ports.HTTP)
|
||||||
server, err := NewHTTPServer(agent, true, agent.logOutput, addr.String())
|
server, err := NewHTTPServer(agent, "", true, agent.logOutput, addr.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user