version: string;
websocketUrl: string;
workbenchUrl: string;
+ vocabularyUrl: string;
}
export const fetchConfig = () => {
.catch(() => Promise.resolve(getDefaultConfig()))
.then(config => Axios
.get<Config>(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,
+ })));
};
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`;