* [COMPLIANCE] Update Copyright and License Headers * chore: make gen to generate files with copyright headers * chore: update missed copyright headers --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Justin Nguyen <justin.nguyen@hashicorp.com>
39 lines
671 B
Go
39 lines
671 B
Go
// Copyright IBM Corp. 2020, 2025
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
//go:build ui
|
|
// +build ui
|
|
|
|
package ui
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
// Sadly we can't embed this into the embed line, but we use it elsewhere
|
|
const contentDir = ".tmp/boundary-ui/ui/admin/dist"
|
|
|
|
// content is our static web server content.
|
|
//
|
|
//go:embed .tmp/boundary-ui/ui/admin/dist
|
|
var content embed.FS
|
|
|
|
func Handler() http.Handler {
|
|
return http.FileServer(httpFileSystem())
|
|
}
|
|
|
|
func httpFileSystem() http.FileSystem {
|
|
return http.FS(fileSystem())
|
|
}
|
|
|
|
func fileSystem() fs.FS {
|
|
// Remove the root
|
|
f, err := fs.Sub(content, contentDir)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return f
|
|
}
|