diff --git a/cmd/query/app/fixture/index.html b/cmd/query/app/fixture/index.html index 1fa312504ce..0bce65817e0 100644 --- a/cmd/query/app/fixture/index.html +++ b/cmd/query/app/fixture/index.html @@ -3,6 +3,10 @@ Test Page - - + diff --git a/cmd/query/app/fixture/ui-config-malformed.js b/cmd/query/app/fixture/ui-config-malformed.js new file mode 100644 index 00000000000..1956f1b31e6 --- /dev/null +++ b/cmd/query/app/fixture/ui-config-malformed.js @@ -0,0 +1,10 @@ +() => { + return { + menu: [ + { + label: "GitHub", + url: "https://github.com/jaegertracing/jaeger" + } + ] + } +} diff --git a/cmd/query/app/fixture/ui-config-menu.js b/cmd/query/app/fixture/ui-config-menu.js new file mode 100644 index 00000000000..74863a63ee4 --- /dev/null +++ b/cmd/query/app/fixture/ui-config-menu.js @@ -0,0 +1,10 @@ +function UIConfig(){ + return { + menu: [ + { + label: "GitHub", + url: "https://github.com/jaegertracing/jaeger" + } + ] + } +} diff --git a/cmd/query/app/fixture/ui-config.js b/cmd/query/app/fixture/ui-config.js new file mode 100644 index 00000000000..edd2a0bfcd8 --- /dev/null +++ b/cmd/query/app/fixture/ui-config.js @@ -0,0 +1,5 @@ +function UIConfig(){ + return { + x: "y" + } +} diff --git a/cmd/query/app/static_handler.go b/cmd/query/app/static_handler.go index bf8632c1859..e60a451b979 100644 --- a/cmd/query/app/static_handler.go +++ b/cmd/query/app/static_handler.go @@ -16,6 +16,7 @@ package app import ( + "bytes" "encoding/json" "fmt" "io/ioutil" @@ -40,6 +41,7 @@ var ( // The following patterns are searched and replaced in the index.html as a way of customizing the UI. configPattern = regexp.MustCompile("JAEGER_CONFIG *= *DEFAULT_CONFIG;") + configJsPattern = regexp.MustCompile(`(?im)^\s*\/\/\s*JAEGER_CONFIG_JS.*\n.*`) versionPattern = regexp.MustCompile("JAEGER_VERSION *= *DEFAULT_VERSION;") basePathPattern = regexp.MustCompile(`