agent: Pass UiDir into the HTTP layer

This commit is contained in:
Armon Dadgar 2014-04-23 12:40:59 -07:00 committed by Jack Pearkes
parent f9ff14531f
commit 2739abab7b
3 changed files with 4 additions and 3 deletions

View File

@ -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))

View File

@ -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()

View File

@ -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)
}