From 85c93508dc959ca5491998283565a8e125a56a86 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Tue, 27 Nov 2018 10:15:07 +0100 Subject: [PATCH] Add vocabulary url to config Feature #14393 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/common/config.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/config.ts b/src/common/config.ts index 1ab73294..c74277e4 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -49,6 +49,7 @@ export interface Config { version: string; websocketUrl: string; workbenchUrl: string; + vocabularyUrl: string; } export const fetchConfig = () => { @@ -58,7 +59,10 @@ export const fetchConfig = () => { .catch(() => Promise.resolve(getDefaultConfig())) .then(config => Axios .get(getDiscoveryURL(config.API_HOST)) - .then(response => ({ config: response.data, apiHost: config.API_HOST }))); + .then(response => ({ + config: {...response.data, vocabularyUrl: config.VOCABULARY_URL }, + apiHost: config.API_HOST, + }))); }; @@ -105,15 +109,18 @@ export const mockConfig = (config: Partial): Config => ({ version: '', websocketUrl: '', workbenchUrl: '', + vocabularyUrl: '', ...config }); interface ConfigJSON { API_HOST: string; + VOCABULARY_URL: string; } const getDefaultConfig = (): ConfigJSON => ({ API_HOST: process.env.REACT_APP_ARVADOS_API_HOST || "", + VOCABULARY_URL: "", }); const getDiscoveryURL = (apiHost: string) => `${window.location.protocol}//${apiHost}/discovery/v1/apis/arvados/v1/rest`; -- 2.30.2