2016-09-16 22:50:49 +00:00
|
|
|
package dist
|
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2022-04-05 10:54:02 +00:00
|
|
|
"github.com/influxdata/chronograf/ui"
|
2016-09-19 16:36:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// DebugAssets serves assets via a specified directory
|
|
|
|
type DebugAssets struct {
|
2016-09-20 02:08:32 +00:00
|
|
|
Dir string // Dir is a directory location of asset files
|
|
|
|
Default string // Default is the file to serve if file is not found.
|
2016-09-19 16:36:48 +00:00
|
|
|
}
|
|
|
|
|
2016-09-19 20:41:51 +00:00
|
|
|
// Handler is an http.FileServer for the Dir
|
|
|
|
func (d *DebugAssets) Handler() http.Handler {
|
2016-09-20 02:08:32 +00:00
|
|
|
return http.FileServer(NewDir(d.Dir, d.Default))
|
2016-09-19 16:36:48 +00:00
|
|
|
}
|
|
|
|
|
2022-03-17 08:54:04 +00:00
|
|
|
// GetVersion returns version of the packed assets
|
2022-03-17 08:32:24 +00:00
|
|
|
func GetVersion() string {
|
2022-04-05 10:54:02 +00:00
|
|
|
return ui.GetVersion()
|
2022-03-17 08:32:24 +00:00
|
|
|
}
|