From 6177a02f18b59d5e10b2c17198baed71fc186d0a Mon Sep 17 00:00:00 2001 From: dannyrb Date: Mon, 29 Apr 2019 13:29:37 -0400 Subject: [PATCH] Shift default config to own file --- .env.development | 14 ++++++++++++++ .env.production | 5 +++++ package.json | 2 +- public/config/default.js | 20 ++++++++++++++++++++ src/index.js | 22 +--------------------- 5 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 .env.development create mode 100644 public/config/default.js diff --git a/.env.development b/.env.development new file mode 100644 index 000000000..062b97107 --- /dev/null +++ b/.env.development @@ -0,0 +1,14 @@ +## +# DEVELOPMENT: Default +# +# We're using this to set variables for our local development. +# Please feel free to delete or modify this file for your own setup. +# Be careful not to commit anything sensitive to source control. +# + +PUBLIC_URL=/ + +# +# Most vars require REACT_APP_* naming +# +REACT_APP_CONFIG=config/default.js diff --git a/.env.production b/.env.production index f00ed441e..464ee6dc5 100644 --- a/.env.production +++ b/.env.production @@ -6,4 +6,9 @@ # environment. Be careful not to commit anything sensitive to source control. # +PUBLIC_URL=/demo + +# +# Most vars require REACT_APP_* naming +# REACT_APP_CONFIG=config/netlify.js diff --git a/package.json b/package.json index c141123d0..52d3cec82 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dev:debug": "cross-env PORT=5000 react-scripts start", "build:package": "yarn run preBuild && node --max-old-space-size=4096 node_modules/rollup/bin/rollup -c", "build:web": "yarn run preBuild && react-scripts build", - "build:web:ci": "yarn run preBuild && cross-env PUBLIC_URL=/demo react-scripts --max_old_space_size=4096 build && cpx 'build/**/*' docs/latest/_book/demo --verbose", + "build:web:ci": "yarn run preBuild && react-scripts --max_old_space_size=4096 build && cpx 'build/**/*' docs/latest/_book/demo --verbose", "lint": "eslint -c .eslintrc --fix src && prettier --single-quote --write src/**/*.{js,jsx,json,css}", "test": "jest", "test:ci": "jest --ci --runInBand --collectCoverage --reporters=default --reporters=jest-junit && codecov", diff --git a/public/config/default.js b/public/config/default.js new file mode 100644 index 000000000..8b7b38b0a --- /dev/null +++ b/public/config/default.js @@ -0,0 +1,20 @@ +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, + }, + }, + ], + }, +} diff --git a/src/index.js b/src/index.js index f5f77244d..171e27363 100644 --- a/src/index.js +++ b/src/index.js @@ -8,27 +8,7 @@ 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, - }, - }, - ], - }, -} - +const applicationProps = window.config const app = React.createElement(App, applicationProps, null) ReactDOM.render(app, document.getElementById('root'))