From 33d06dba4e072a444b766fd382f241be376c1516 Mon Sep 17 00:00:00 2001 From: dannyrb Date: Tue, 30 Apr 2019 11:56:13 -0400 Subject: [PATCH] how it works --- docs/latest/deployment/index.md | 2 +- .../recipes/build-for-production.md | 38 ++++++++++++++++--- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/docs/latest/deployment/index.md b/docs/latest/deployment/index.md index 178322173..88e2a265b 100644 --- a/docs/latest/deployment/index.md +++ b/docs/latest/deployment/index.md @@ -62,7 +62,7 @@ deployment experience. "Building", or creating, the files you will need is the same regardless of the web host you choose. You can find detailed instructions on how to configure and build the OHIF Viewer in our -["Build for Production" guide](./build-for-production.md). +["Build for Production" guide](./recipes/build-for-production.md). ##### Part 2 - Host Your App diff --git a/docs/latest/deployment/recipes/build-for-production.md b/docs/latest/deployment/recipes/build-for-production.md index c8a19246c..6ab01c731 100644 --- a/docs/latest/deployment/recipes/build-for-production.md +++ b/docs/latest/deployment/recipes/build-for-production.md @@ -33,8 +33,8 @@ _From .zip:_ ### Restore Dependencies & Build -Open PowerShell, Terminal, or a Command Prompt, and navigate to the directory -containing the source files. Next run these commands: +Open your terminal, and navigate to the directory containing the source files. +Next run these commands: ```js // Restore dependencies @@ -64,11 +64,37 @@ 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 -- env vars -- `REACT_APP_*` -- config file(s) +#### 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. Ultimately setting the`window.config` +equal to our configuration file's value. + +- Modify its values directly +- Create a new config file, and set the `REACT_APP_CONFIG` environement variable +- + +The build process knows which file to use based on 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) +- + +* env vars +* `REACT_APP_*` +* config file(s) ## Next Steps