Simplify loading init config

This commit is contained in:
dannyrb 2019-04-29 13:20:11 -04:00
parent 775a91152c
commit eec3155298

View File

@ -1,19 +1,37 @@
/** /**
* Entry point index.js for development * Entry point for development and production PWA builds.
* Packaged (NPM) builds go through `index_publish.js`
*/ */
import App from './App.js'
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App.js'; export { App }
import React from 'react';
import ReactDOM from 'react-dom';
export { App }; const applicationProps = window.config || {
routerBasename: '/',
rootUrl: 'http://localhost:5000',
servers: {
dicomWeb: [
{
name: 'DCM4CHEE',
wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado',
qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
qidoSupportsIncludeField: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
},
],
},
}
var rootUrl = 'http://localhost:5000'; const app = React.createElement(App, applicationProps, null)
var routerBasename = '/';
var props = { ReactDOM.render(app, document.getElementById('root'))
routerBasename: routerBasename,
rootUrl: rootUrl
};
/* /*
Example config with OIDC Example config with OIDC
@ -87,24 +105,6 @@ props.oidc = [
} }
]; */ ]; */
/* Example config without OIDC */
props.servers = {
dicomWeb: [
{
name: 'DCM4CHEE',
wadoUriRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado',
qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
qidoSupportsIncludeField: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true
}
}
]
};
/*props.servers = { /*props.servers = {
"dicomWeb": [ "dicomWeb": [
{ {
@ -169,23 +169,3 @@ White labelling example
props.whiteLabelling = { props.whiteLabelling = {
logoComponent: RadicalImagingLogo() logoComponent: RadicalImagingLogo()
};*/ };*/
// Note: Run your build like this:
// REACT_APP_CONFIG=$(cat ../config-react/ccc.json) yarn start
//
// If you change the JSON config, you need to re-run the command!
const configString = process.env && process.env && process.env.REACT_APP_CONFIG;
if (configString) {
const configJSON = JSON.parse(configString);
if (configJSON.servers) {
props.servers = configJSON.servers;
}
if (configJSON.oidc) {
props.oidc = configJSON.oidc;
}
}
var app = React.createElement(App, props, null);
ReactDOM.render(app, document.getElementById('root'));