Add a feature flag to override Juno endpoint (#700)

* Add a feature flag to override Juno endpoint

* Fix build
This commit is contained in:
Tanuj Mittal
2021-04-19 17:38:53 -07:00
committed by GitHub
parent f2585bba14
commit 914e969083
4 changed files with 60 additions and 20 deletions

View File

@@ -13,6 +13,7 @@ export type Features = {
readonly enableTtl: boolean;
readonly executeSproc: boolean;
readonly hostedDataExplorer: boolean;
readonly junoEndpoint?: string;
readonly livyEndpoint?: string;
readonly notebookBasePath?: string;
readonly notebookServerToken?: string;
@@ -27,7 +28,8 @@ export type Features = {
export function extractFeatures(given = new URLSearchParams(window.location.search)): Features {
const downcased = new URLSearchParams();
const set = (value: string, key: string) => downcased.set(key.toLowerCase(), value);
const get = (key: string, defaultValue?: string) => downcased.get("feature." + key) ?? defaultValue;
const get = (key: string, defaultValue?: string) =>
downcased.get("feature." + key) ?? downcased.get(key) ?? defaultValue;
try {
new URLSearchParams(window.parent.location.search).forEach(set);
@@ -52,6 +54,7 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
enableTtl: "true" === get("enablettl"),
executeSproc: "true" === get("dataexplorerexecutesproc"),
hostedDataExplorer: "true" === get("hosteddataexplorerenabled"),
junoEndpoint: get("junoendpoint"),
livyEndpoint: get("livyendpoint"),
notebookBasePath: get("notebookbasepath"),
notebookServerToken: get("notebookservertoken"),