From e53b57a642a40f8dfa61d991c915c40eae6d6bc7 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Fri, 10 May 2019 09:55:24 -0400 Subject: [PATCH] Configuration --- .../recipes/build-for-production.md | 6 +- docs/latest/essentials/configuration.md | 58 ++++++++++++++++++- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/docs/latest/deployment/recipes/build-for-production.md b/docs/latest/deployment/recipes/build-for-production.md index 92673e69a..37b675941 100644 --- a/docs/latest/deployment/recipes/build-for-production.md +++ b/docs/latest/deployment/recipes/build-for-production.md @@ -65,10 +65,8 @@ how to configure the project for your own imaging archive below. ### Configuration > This step assumes you have an imaging archive. If you need assistance setting -> one up, check out the [`Data` section](./../index.md#data) of our Deployment -> Guide, or `Getting Started`'s -> ["Set up a local DICOM server"](./../../essentials/getting-started.md#set-up-a-local-dicom-server), -> or a deployment recipe that contains an open source Image Archive +> one up, check out the [`Data Source` Guide](./../essentials/data-source.md) or +> a deployment recipe that contains an open source Image Archive #### How it Works diff --git a/docs/latest/essentials/configuration.md b/docs/latest/essentials/configuration.md index af4abbfe2..7017b4d97 100644 --- a/docs/latest/essentials/configuration.md +++ b/docs/latest/essentials/configuration.md @@ -1 +1,57 @@ -# Configuration \ No newline at end of file +# Configuration + +> This step assumes you have an imaging archive. If you need assistance setting +> one up, check out the [`Data Source` Guide](./data-source.md) or a deployment +> recipe that contains an open source Image Archive + +## How it Works + +The configuration for our project is in the `/public/config` directory. Our +build process knows which configuration file to use based on the +`REACT_APP_CONFIG` environment variable. By default, its value is +[`default.js`](https://github.com/OHIF/Viewers/blob/react/public/config/default.js). +When we build, the `%REACT_APP_CONFIG%` value in +our[`/public/index.html`](https://github.com/OHIF/Viewers/blob/react/public/index.html#L12-L15) +file is substituted for the correct configuration file's name. This sets the +`window.config` equal to our configuration file's value. + +## How do I configure my project? + +The simplest way is to update the existing default config: + +_/public/config/default.js_ + +```js +window.config = { + routerBasename: '/', + relativeWebWorkerScriptsPath: '', + 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, + }, + }, + ], + }, +} +``` + +You can also create a new config file and specify its path relative to the build +output's root by setting the `REACT_APP_CONFIG` environment variable. You can +set the value of this environment variable a few different ways: + +- [Add a temporary environment variable in your shell](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-temporary-environment-variables-in-your-shell) +- [Add environment specific variables in `.env` file(s)](https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#adding-development-environment-variables-in-env) +- Using the `cross-env` package in an npm script: + - `"build": "cross-env REACT_APP_CONFIG=config/my-config.js react-scripts build"` + +After updating the configuration, `yarn run build:web` to generate updated build +output.