Merge remote-tracking branch 'origin/main' into feature/home_page_filter_links
This commit is contained in:
commit
09fca807a4
|
@ -34,8 +34,9 @@ if [[ -n "$react_configs" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
escaped_react_config=$(sed -E 's|/|\\/|g' <<<"${react_config_without_prefix}")
|
||||||
# actually do the search and replace to add the js config to the html page
|
# actually do the search and replace to add the js config to the html page
|
||||||
perl -pi -e "s/(window.spiffworkflowFrontendJsenv=\{\})/\1;window.spiffworkflowFrontendJsenv.${react_config_without_prefix}/" "$index_html_file"
|
perl -pi -e "s/(window.spiffworkflowFrontendJsenv=\{\})/\1;window.spiffworkflowFrontendJsenv.${escaped_react_config}/" "$index_html_file"
|
||||||
|
|
||||||
if ! grep -Eq "${react_config_without_prefix}" "$index_html_file"; then
|
if ! grep -Eq "${react_config_without_prefix}" "$index_html_file"; then
|
||||||
>&2 echo "ERROR: Could not find '${react_config_without_prefix}' in '${index_html_file}' after search and replace. It is likely that the assumptions in boot_server_in_docker about the contents of the html page have changed. Fix the glitch in boot_server_in_docker."
|
>&2 echo "ERROR: Could not find '${react_config_without_prefix}' in '${index_html_file}' after search and replace. It is likely that the assumptions in boot_server_in_docker about the contents of the html page have changed. Fix the glitch in boot_server_in_docker."
|
||||||
|
|
|
@ -12,6 +12,7 @@ declare global {
|
||||||
|
|
||||||
let spiffEnvironment = '';
|
let spiffEnvironment = '';
|
||||||
let appRoutingStrategy = 'subdomain_based';
|
let appRoutingStrategy = 'subdomain_based';
|
||||||
|
let backendBaseUrl = null;
|
||||||
if ('spiffworkflowFrontendJsenv' in window) {
|
if ('spiffworkflowFrontendJsenv' in window) {
|
||||||
if ('APP_ROUTING_STRATEGY' in window.spiffworkflowFrontendJsenv) {
|
if ('APP_ROUTING_STRATEGY' in window.spiffworkflowFrontendJsenv) {
|
||||||
appRoutingStrategy = window.spiffworkflowFrontendJsenv.APP_ROUTING_STRATEGY;
|
appRoutingStrategy = window.spiffworkflowFrontendJsenv.APP_ROUTING_STRATEGY;
|
||||||
|
@ -19,8 +20,12 @@ if ('spiffworkflowFrontendJsenv' in window) {
|
||||||
if ('ENVIRONMENT_IDENTIFIER' in window.spiffworkflowFrontendJsenv) {
|
if ('ENVIRONMENT_IDENTIFIER' in window.spiffworkflowFrontendJsenv) {
|
||||||
spiffEnvironment = window.spiffworkflowFrontendJsenv.ENVIRONMENT_IDENTIFIER;
|
spiffEnvironment = window.spiffworkflowFrontendJsenv.ENVIRONMENT_IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
if ('BACKEND_BASE_URL' in window.spiffworkflowFrontendJsenv) {
|
||||||
|
backendBaseUrl = window.spiffworkflowFrontendJsenv.BACKEND_BASE_URL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!backendBaseUrl) {
|
||||||
let hostAndPortAndPathPrefix;
|
let hostAndPortAndPathPrefix;
|
||||||
if (appRoutingStrategy === 'subdomain_based') {
|
if (appRoutingStrategy === 'subdomain_based') {
|
||||||
hostAndPortAndPathPrefix = `api.${hostname}`;
|
hostAndPortAndPathPrefix = `api.${hostname}`;
|
||||||
|
@ -46,23 +51,21 @@ if (/^\d+\./.test(hostname) || hostname === 'localhost') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
backendBaseUrl = `${protocol}://${hostAndPortAndPathPrefix}/v1.0`;
|
||||||
'spiffworkflowFrontendJsenv' in window &&
|
|
||||||
'APP_ROUTING_STRATEGY' in window.spiffworkflowFrontendJsenv
|
|
||||||
) {
|
|
||||||
appRoutingStrategy = window.spiffworkflowFrontendJsenv.APP_ROUTING_STRATEGY;
|
|
||||||
}
|
|
||||||
|
|
||||||
let url = `${protocol}://${hostAndPortAndPathPrefix}/v1.0`;
|
|
||||||
|
|
||||||
// this can only ever work locally since this is a static site.
|
// this can only ever work locally since this is a static site.
|
||||||
// use spiffworkflowFrontendJsenv if you want to inject env vars
|
// use spiffworkflowFrontendJsenv if you want to inject env vars
|
||||||
// that can be read by the static site.
|
// that can be read by the static site.
|
||||||
if (process.env.REACT_APP_BACKEND_BASE_URL) {
|
if (process.env.REACT_APP_BACKEND_BASE_URL) {
|
||||||
url = process.env.REACT_APP_BACKEND_BASE_URL;
|
backendBaseUrl = process.env.REACT_APP_BACKEND_BASE_URL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BACKEND_BASE_URL = url;
|
if (!backendBaseUrl.endsWith('/v1.0')) {
|
||||||
|
backendBaseUrl += '/v1.0';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const BACKEND_BASE_URL = backendBaseUrl;
|
||||||
|
|
||||||
export const PROCESS_STATUSES = [
|
export const PROCESS_STATUSES = [
|
||||||
'not_started',
|
'not_started',
|
||||||
|
|
Loading…
Reference in New Issue