2022-12-21 11:06:09 -05:00
|
|
|
const { port, hostname } = window.location;
|
|
|
|
let hostAndPort = `api.${hostname}`;
|
2022-10-17 17:18:24 -04:00
|
|
|
let protocol = 'https';
|
2022-12-21 11:06:09 -05:00
|
|
|
|
|
|
|
if (/^\d+\./.test(hostname) || hostname === 'localhost') {
|
|
|
|
let serverPort = 7000;
|
|
|
|
if (!Number.isNaN(Number(port))) {
|
|
|
|
serverPort = Number(port) - 1;
|
|
|
|
}
|
|
|
|
hostAndPort = `${hostname}:${serverPort}`;
|
2022-10-17 17:18:24 -04:00
|
|
|
protocol = 'http';
|
|
|
|
}
|
2022-12-21 11:06:09 -05:00
|
|
|
|
|
|
|
let url = `${protocol}://${hostAndPort}/v1.0`;
|
|
|
|
// Allow overriding the backend base url with an environment variable at build time.
|
|
|
|
if (process.env.REACT_APP_BACKEND_BASE_URL) {
|
|
|
|
url = process.env.REACT_APP_BACKEND_BASE_URL;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const BACKEND_BASE_URL = url;
|
2022-10-12 10:21:49 -04:00
|
|
|
|
|
|
|
export const PROCESS_STATUSES = [
|
|
|
|
'not_started',
|
|
|
|
'user_input_required',
|
|
|
|
'waiting',
|
|
|
|
'complete',
|
2022-11-10 15:55:17 -05:00
|
|
|
'error',
|
2022-10-12 10:21:49 -04:00
|
|
|
'suspended',
|
2022-12-02 13:47:04 -05:00
|
|
|
'terminated',
|
2022-10-12 10:21:49 -04:00
|
|
|
];
|
|
|
|
|
2022-11-02 12:42:49 -04:00
|
|
|
// with time: yyyy-MM-dd HH:mm:ss
|
2022-11-10 15:44:58 -05:00
|
|
|
export const DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
2022-11-17 16:05:54 -05:00
|
|
|
export const TIME_FORMAT_HOURS_MINUTES = 'HH:mm';
|
2022-11-02 12:42:49 -04:00
|
|
|
export const DATE_FORMAT = 'yyyy-MM-dd';
|
|
|
|
export const DATE_FORMAT_CARBON = 'Y-m-d';
|