mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-19 08:30:12 +01:00
Added dashboard
This commit is contained in:
parent
d744c34886
commit
130429b10a
22 changed files with 2986 additions and 14 deletions
36
pkg/dashboard/dashboard.go
Normal file
36
pkg/dashboard/dashboard.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package dashboard
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Dashboard is the http server responsible for serving the static Dashboard files
|
||||
type Dashboard struct {
|
||||
}
|
||||
|
||||
// New is a factory function creating a new Dashboard instance
|
||||
func New() *Dashboard {
|
||||
return &Dashboard{}
|
||||
}
|
||||
|
||||
// Start the Dashboard and serve over HTTP
|
||||
func (dashboard *Dashboard) Start() error {
|
||||
go func() {
|
||||
runHTTPServer()
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
func runHTTPServer() {
|
||||
serveMux := http.NewServeMux()
|
||||
serveMux.Handle("/", getHandler())
|
||||
|
||||
log.Debug("Starting http dashboard server")
|
||||
log.Fatal(http.ListenAndServe(":8001", serveMux))
|
||||
}
|
||||
|
||||
func getHandler() http.Handler {
|
||||
return http.FileServer(http.Dir("./pkg/dashboard/static"))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue