feat(ui): serve controller metadata from ui handler (#3120)

* adds noop metadata function to OSS UI handler
* removes old-style build tags for UI handler files
This commit is contained in:
Haotian authored and GitHub committed 2023-03-31 13:09:48 -07:00
1 parent 5e43976947
commit 5b26634b8a
2 files changed
+7 -3

No files matched your search

+7 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: MPL-2.0
//go:build ui
// +build ui
package controller
import (
"context"
"net/http"
"strings"
@@ -17,6 +17,9 @@ func init() {
handleUi = handleUiWithAssets
}
// serveMetadata provides controller metadata to the UI for licensed versions of Boundary.
var serveMetadata = func(ctx context.Context, w http.ResponseWriter) {}
func handleUiWithAssets(c *Controller) http.Handler {
var nextHandler http.Handler
if c.conf.RawConfig.DevUiPassthroughDir != "" {
@@ -40,7 +43,9 @@ func handleUiWithAssets(c *Controller) http.Handler {
default:
switch r.URL.Path {
case "/", "/favicon.png", "/assets/styles.css":
case "/metadata.json":
serveMetadata(c.baseContext, w)
return
default:
for i := dotIndex + 1; i < len(r.URL.Path); i++ {
intVal := r.URL.Path[i]
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: MPL-2.0
//go:build ui
// +build ui
package controller