agent: Pass UiDir into the HTTP layer
This commit is contained in:
parent
a70361282e
commit
32889c2f70
|
@ -180,7 +180,7 @@ func (c *Command) setupAgent(config *Config, logOutput io.Writer, logWriter *log
|
|||
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 {
|
||||
agent.Shutdown()
|
||||
c.Ui.Error(fmt.Sprintf("Error starting http server: %s", err))
|
||||
|
|
|
@ -21,11 +21,12 @@ type HTTPServer struct {
|
|||
mux *http.ServeMux
|
||||
listener net.Listener
|
||||
logger *log.Logger
|
||||
uiDir string
|
||||
}
|
||||
|
||||
// NewHTTPServer starts a new HTTP server to provide an interface to
|
||||
// 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
|
||||
mux := http.NewServeMux()
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ func makeHTTPServer(t *testing.T) (string, *HTTPServer) {
|
|||
conf := nextConfig()
|
||||
dir, agent := makeAgent(t, conf)
|
||||
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 {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue