1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import Axios from "axios";
7 export const CONFIG_URL = process.env.REACT_APP_ARVADOS_CONFIG_URL || "/config.json";
9 export interface Config {
13 export const fetchConfig = () => {
15 .get<Config>(CONFIG_URL + "?nocache=" + (new Date()).getTime())
16 .then(response => response.data)
17 .catch(() => Promise.resolve(getDefaultConfig()))
21 const mapConfig = (config: Config): Config => ({
23 API_HOST: addProtocol(config.API_HOST)
26 const getDefaultConfig = (): Config => ({
27 API_HOST: process.env.REACT_APP_ARVADOS_API_HOST || ""
30 const addProtocol = (url: string) => `${window.location.protocol}//${url}`;