Merge branch 'main' into plugin-hostcatalogs

This commit is contained in:
Jeff Mitchell committed 2021-10-14 12:14:07 -04:00
commit f01a8060a0
7 files changed
+19 -19

No files matched your search

+4 -4
View File
@@ -8,13 +8,13 @@ import (
"github.com/hashicorp/boundary/internal/observability/event"
)
func devPassthroughHandler(passthroughDir string) http.Handler {
func devUiPassthroughHandler(uiPassthroughDir string) http.Handler {
const op = "controller.devPassthroughHandler"
ctx := context.TODO()
// Panic may not be ideal but this is never a production call and it'll
// panic on startup. We could also just change the function to return
// an error.
abs, err := filepath.Abs(passthroughDir)
abs, err := filepath.Abs(uiPassthroughDir)
if err != nil {
panic(err)
}
@@ -26,8 +26,8 @@ func devPassthroughHandler(passthroughDir string) http.Handler {
}
var handleUi = func(c *Controller) http.Handler {
if c.conf.RawConfig.PassthroughDirectory != "" {
return devPassthroughHandler(c.conf.RawConfig.PassthroughDirectory)
if c.conf.RawConfig.DevUiPassthroughDir != "" {
return devUiPassthroughHandler(c.conf.RawConfig.DevUiPassthroughDir)
}
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
+2 -2
View File
@@ -16,8 +16,8 @@ func init() {
func handleUiWithAssets(c *Controller) http.Handler {
var nextHandler http.Handler
if c.conf.RawConfig.PassthroughDirectory != "" {
nextHandler = devPassthroughHandler(c.conf.RawConfig.PassthroughDirectory)
if c.conf.RawConfig.DevUiPassthroughDir != "" {
nextHandler = devUiPassthroughHandler(c.conf.RawConfig.DevUiPassthroughDir)
} else {
nextHandler = ui.Handler()
}
@@ -41,7 +41,7 @@ func TestUiRouting(t *testing.T) {
c := NewTestController(t, &TestControllerOpts{DisableAutoStart: true})
c.c.conf.RawConfig.PassthroughDirectory = tempDir
c.c.conf.RawConfig.DevUiPassthroughDir = tempDir
require.NoError(t, c.c.Start())
defer c.Shutdown()