2023-03-15 16:00:52 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2022-01-05 18:02:03 +00:00
|
|
|
//go:build ui
|
2021-08-18 15:05:11 +00:00
|
|
|
|
|
|
|
package http
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"io/fs"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// content is our static web server content.
|
2022-09-08 00:31:20 +00:00
|
|
|
//
|
2021-08-18 15:05:11 +00:00
|
|
|
//go:embed web_ui/*
|
|
|
|
var content embed.FS
|
|
|
|
|
|
|
|
// assetFS is a http Filesystem that serves the generated web UI from the
|
|
|
|
// "ember-dist" make step
|
|
|
|
func assetFS() http.FileSystem {
|
|
|
|
// sub out to web_ui, where the generated content lives
|
|
|
|
f, err := fs.Sub(content, "web_ui")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return http.FS(f)
|
|
|
|
}
|